Hacker News new | ask | show | jobs
by jackseviltwin 4849 days ago
(Tech lead @ CropUp)

In the first iteration, we thought multiple ngViews would have been useful, but it didn't prevent us from achieving the design we wanted. You can use ngInclude to accomplish a similar effect, if you don't need the routing.

AngularUI seems to have a solution for nested views/routing here (https://github.com/angular-ui/ui-router). Although, I would think about your routes and the pieces of your web application and rethink whether you really need ngView. Using ngIncludes for pieces you want to reuse might make more sense.

edit: for clarity

1 comments

It sure makes more sense, but you need to write boilerplate code to map URL state to ng-include changes/updates. It would be nice if it was out of the box.
I don't know the details of your app but maybe you should consider using ngView in the outer most container, then everything inside the container can pick the appropriate template via ngInclude. That's the path we took in our first iteration, this current iteration actually doesn't need nested/multiple ngViews.