码迷,mamicode.com
首页 > 其他好文 > 详细

angular Multiple Named Views记录

时间:2015-08-29 11:18:56      阅读:194      评论:0      收藏:0      [点我收藏+]

标签:


Notice that the view names are now specified as absolute names, as opposed to the relative name. It is targeting the ‘filters‘, ‘tabledata‘, and ‘graph‘ views located in the root unnamed template. Since it‘s unnamed, there is nothing following the ‘@‘. The root unnamed template is your index.html.

.state(‘report‘,{
    views: {      ‘filters@‘: { },      ‘tabledata@‘: { },      ‘graph@‘: { }
    }
  })

@后面没有名字,默认index.html(入口页面)就是模板文件

例子如下:http://plnkr.co/edit/ujgXbPJXQ3E13F9aFPBc?p=preview

例子中

 .state(‘route2‘, {
              url: "/route2",
                  views: {
                    ‘route2_1@‘: {
                    	templateUrl: "route2.html",
                      controller: function($scope){
                        alert("bbbb");
                      }
                    },
                    ‘route2_2@‘: {
                    	templateUrl: "route2.html",
                      controller: function($scope){
                      alert("aaa");
                      }
                    }
                  }
          })

route2@和route3@的@后面都没有名字,所以默认模板在入口index.html中找对应的ui-view

angular Multiple Named Views记录

标签:

原文地址:http://my.oschina.net/liangzhenghui/blog/498915

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!