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: { ‘[email protected]‘: { }, ‘[email protected]‘: { }, ‘[email protected]‘: { } } })
@后面没有名字,默认index.html(入口页面)就是模板文件
例子如下:http://plnkr.co/edit/ujgXbPJXQ3E13F9aFPBc?p=preview
例子中
.state(‘route2‘, { url: "/route2", views: { ‘[email protected]‘: { templateUrl: "route2.html", controller: function($scope){ alert("bbbb"); } }, ‘[email protected]‘: { templateUrl: "route2.html", controller: function($scope){ alert("aaa"); } } } })
[email protected]和[email protected]的@后面都没有名字,所以默认模板在入口index.html中找对应的ui-view
时间: 2024-12-06 04:17:09