ps the solution for having nested views using
ng-switch<http://www.bennadel.com/blog/2441-Nested-Views-Routing-And-Deep-Linking-With-AngularJS.htm>wouldn't
work, since it would require a fixed set of possible subviews,
where my set of possible subviews is dynamic.
On Friday, March 28, 2014 12:31:14 PM UTC+1, René Verheij wrote:
>
> hi,
>
> *Description*
> Every single view in my app is a view of a certain "item" from the
> database, and each of those views may need to display "subviews" of
> subitems, though it's the data of those subitems themselves that determine
> what kind of subview that becomes.
> And this process can repeat itself several levels deep.
>
> *Example (skip when in hurry)*
> I see in the database that for the homepage I need to display
> "collection_1".
> I also see that "collection_1" has 3 items: 2 of type "category" and 1 of
> type "specialCategory".
> So I tell the collection to display itself. The collection then looks at
> its type ("Collection"), and sees that this type that comes with a default
> viewtype "Grid".
> So the grid template is loaded, which creates some basic HTML for the
> grid, and then tells each of the items (categories in this case) to
> represent themselves.
> So here again, these categories will look at their types, and the special
> category will pick a different view/template then the normal "category"
> items.
>
> *Problem*
> I'm just getting started with Angular and I'm wondering what the best way
> would be to set this up.
> I've read about all the basics, i.e.: controllers, directives, ng-view,
> ng-include,
> routing..
> I've also read several articles about nested
> views<http://www.bennadel.com/blog/2441-Nested-Views-Routing-And-Deep-Linking-With-AngularJS.htm>,
>
> deep linking an ng-switch...
>
> *The solution I'm thinking off*
> is to create a directive myView so that I can simply put in <myView
> of="collection_1">, where the directive will look at the data of the model
> and determine what kind of view to use.
> It should then replace <myView> with the actual HTML of the view.
>
> *What I'm not sure of is *
> - if this setup will create performance issues if I have many <myView>
> tags that need to be replaced an in turn my have their own <myView> tags of
> their sub items (besides the obvious issues with having to load from the
> database)
> - what the best way would be to have directive dynamically pick a template
> and replace the <myView> with that template and it's controller.
>
> To those that will say "just try" be sure I will do just that ...
> though for those that read all this and have some sort of advice on 'the
> right / best way to go' it would be very much appreciated!
>
>
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.