How to open a new ng-view inside ng-view?

How use ng-view inside ng-view?

  • I have main ng-view, and controller with left\right side. The right side is fixed, but left side I want change by other templates and controllers. http://plnkr.co/edit/MTxmmZWRY7O0nH88qK3F <div ng-controller="MainCtrl as main"> Choose: <a href="Book/Moby">Moby</a> | <a href="Book/Moby/ch/1">Moby: Ch1</a> | <a href="Book/Gatsby">Gatsby</a> | <a href="Book/Gatsby/ch/4?key=value">Gatsby: Ch4</a> | <a href="Book/Scarlet">Scarlet Letter</a><br/> <div class="left-side view-animate-container"> <div ng-view class="view-animate"></div> </div> <div class="some-fixed-right-side"> <pre>$location.path() = {{main.$location.path()}}</pre> <pre>$route.current.templateUrl = {{main.$route.current.templateUrl}}</pre> <pre>$route.current.params = {{main.$route.current.params}}</pre> <pre>$routeParams = {{main.$routeParams}}</pre> </div> </div>

  • Answer:

    I used a solution derived from here: http://www.bennadel.com/blog/2420-Mapping-AngularJS-Routes-Onto-URL-Parameters-And-Client-Side-Events.htm Allowing me to effectively nest views (and skipping the limited ng-view altogether) After doing so, this other (simpler, better, I believe) solution appeared: http://angular-ui.github.com/ (scroll down to "Route Checking")

Mediator at Stack Overflow Visit the source

Was this solution helpful to you?

Other answers

You can not. Just use https://github.com/angular-ui/ui-router for that. It allows using nested views.

Mikalai

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.