3

I am porting to AngularDart an app in which a user's UI contains three panels:

  1. Question panel in which s/he can answer.
  2. A (readonly) panel in which his/her can see a partner answering the same questions.
  3. A common panel where both the user and his/her partner can collaborate on various activities.

Based on the answer to this [1] question, it seems that a "logical page" (rendered from, say, a file abc.html) can contain multiple views. Is this situation of have three panels a good use case for Angular views? If so

Question: how can can I define a page with three views in AngularDart? And what are the standard view update mechanisms (i.e., code examples of how those views would be updated)?

I have not found any examples of the use of multiple views and/or how to populate them through, say, a view() RouteEventHandler (or not). All I have found is what is given below.


The AngularDart tutorial gives an example, in Chapter 6, of index.html containing a single view

  <section id="details">
    <ng-view></ng-view>
  </section>

that is populated, in part, through the routing configuration, e.g.:

router.root
  ..addRoute(
      name: 'add',
      path: '/add',
      enter: view('view/addRecipe.html'))

[1] AngularDart: "logical pages" and views are 1-to-1 or 1-to-many or what?

Community
  • 1
  • 1
Patrice Chalin
  • 15,440
  • 7
  • 33
  • 44

2 Answers2

0

This AngularDart sample app seems to have multiple views

vsavkin / angulardart-sample-app

Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
  • Thanks. This looks like a great reference. Will dive into it and then get back with feedback. – Patrice Chalin Feb 01 '14 at 17:29
  • Cannot get it to run at this point because issue arises: [Issue 16071, "Couldn't parse VM stack trace line 'null'." in pub get](https://code.google.com/p/dart/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Type%20Status%20Priority%20Area%20Milestone%20Owner%20Summary&groupby=&sort=&id=16071). – Patrice Chalin Feb 02 '14 at 00:59
  • 2
    It turns out that the angulardart-sample-app doesn't illustrate support for multiple views; although nested views are shown. – Patrice Chalin Feb 17 '14 at 22:39
0

After some digging I have found that it is not currently possible, either in AngularDart or AngularJS (e.g., see this post).

In fact, such a feature was proposed in AngularJs and eventually rejected as can be seen by the discussion associated with Angular.js Pull Request #1198.

Recommended alternatives include:

  • Use of ng-include.
  • For Angular.js, use of the Angular-ui/ui-router which has support for multiple named views.
  • For AngularDart, there is this port: angular.dart.ui, but I do not know how feature complete it is.
Community
  • 1
  • 1
Patrice Chalin
  • 15,440
  • 7
  • 33
  • 44
  • The comment regarding the rejection is a little misleading out of context. The comment from Misko ends with: "the current proposed solution breaks certain things. We do want multiple view feature, but unfortunately we don't think this approach would work.". So it is the implementation that doesn't fit the vision for Angular, not the actual feature. – ppearcy Apr 07 '14 at 04:49
  • In fact, rereading this, the quote doesn't add much to the answer, so I have removed it. Thanks for your feedback @ppearcy. – Patrice Chalin Apr 07 '14 at 13:18