AngularJS - Multiple ng-view in single template

后端 未结 6 1789
我寻月下人不归
我寻月下人不归 2020-11-29 17:38

I am building a dynamic web app by using AngularJS. Is it possible to have multiple ng-view on a single template?

6条回答
  •  甜味超标
    2020-11-29 18:13

    It is possible to have multiple or nested views. But not by ng-view.

    The primary routing module in angular does not support multiple views. But you can use ui-router. This is a third party module which you can get via Github, angular-ui/ui-router, https://github.com/angular-ui/ui-router . Also a new version of ngRouter (ngNewRouter) currently, is being developed. It is not stable at the moment. So I provide you a simple start up example with ui-router. Using it you can name views and specify which templates and controllers should be used for rendering them. Using $stateProvider you should specify how view placeholders should be rendered for specific state.

    
        
        home
        
    header
    content
    footer
提交回复
热议问题