Angular UI-Router multiple views

前端 未结 2 1697
北荒
北荒 2020-12-02 08:07

I am using angular UI-Router. I have the following in my route config

.config(function config($stateProvider) {
  $sta         


        
2条回答
  •  既然无缘
    2020-12-02 08:30

    I find the example on the official GitHub wiki to be very unintuitive. Here is a better one:

    https://scotch.io/tutorials/angular-routing-using-ui-router

    For instance:

    ...
    
    .state('bulletinBoard', {
        url: '/bulletinBoard',
        views: {
    
            // the main template will be placed here (relatively named)
            '': { templateUrl: '../src/app/bulletinBoard/views/bulletinBoard.part.html' },
    
            // the child views will be defined here (absolutely named)
            'tradeFeed@bulletinBoard': { template: ..... },
    
            // another child view
            'newsFeed@bulletinBoard': { 
                templateUrl: ......
            }
        }
    
    });
    

    The syntax of each view attribute being viewName@stateName.

提交回复
热议问题