多命名视图的范围继承失败? [英] Scope inheritance fails with multiple-named views?
本文介绍了多命名视图的范围继承失败?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
从 (Plnkr) 移动时会中断:
It breaks when moving from (Plnkr):
.state('home', {url: '/home', template: '<pre>{{parentProp}}</pre>',
controller: function ($scope) {$scope.parentProp = ['home'];}})
致(Plnkr):
.state('home', {url: '/home', views: {'': {template: '<pre>{{parentProp}}</pre>'}},
controller: function ($scope) {$scope.parentProp = ['home'];}})`
具体来说,我有一个 'sidebar'
状态,我想将其作为辅助状态添加到 'home'
.
Specifically I have a 'sidebar'
state I want to add as a secondary state to 'home'
.
推荐答案
视图需要自己的控制器:
The view needs its own controller:
.state('home', {url: '/home',
views: {'': {template: '<pre>{{parentProp}}</pre>',
controller: function ($scope) {
$scope.parentProp = ['home'];
}
}
},
})`
http://plnkr.co/edit/giW3XRspEV7SEPM1UDeC?p=preview
这篇关于多命名视图的范围继承失败?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文