有一个与正在工作的矮人有关的链接。
该
UI-Router逻辑如何找到一个视图的目标/锚: 总是试图插入
child到
parent。如果不可能,请使用绝对命名。看到:
[视图名称-相对名称与绝对名称](https://github.com/angular-ui/ui-router/wiki/Multiple-
Named-Views#view-names—relative-vs-absolute-names)
因此,我更改的是,父未命名视图现在包含子对象的目标/锚点-未命名视图
<ui-view />:
.state('root', { abstract: true, views: { '@': { template: '<ui-view />', // NEW line, with a target for a child controller: 'RootCtrl', controllerAs: 'rootCtrl' }, ....另外,因为我们说过,默认网址是
$urlRouterProvider.otherwise('/home');我们必须有这样的状态:
.state('root.home',{ parent:'root', url:'/home', // this is the otherwise, to have something on a start up在这里检查
此处使用unk子的另一种方法可能是针对子级的根视图:
.state('root.home',{ parent:'root', url:'/home', views: { '@': { templateUrl:'home.html', controller: 'HomeController', controllerAs:'homeCtrl' } },在这种情况下,父状态不是必须的
<ui-view />-我们以root 为目标,但我们不会继承任何东西…为什么呢?看到这个链接:
[仅按视图层次结构的作用域继承](https://github.com/angular-ui/ui-router/wiki/Nested-
States-%26-Nested-Views#scope-inheritance-by-view-hierarchy-only)



