首页 > 其他 > 详细

angular Multiple Named Views记录

时间:2015-08-29 11:15:50      阅读:180      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!