范围继承失败,多命名的看法?(Scope inheritance fails with multip

2019-10-20 07:56发布

从(移动时它打破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'

Answer 1:

视图需要自己控制:

.state('home', {url: '/home',
                views: {'': {template: '<pre>{{parentProp}}</pre>',
                             controller: function ($scope) {
                                             $scope.parentProp = ['home'];
                                         }
                             }
                        },
                })`

http://plnkr.co/edit/giW3XRspEV7SEPM1UDeC?p=preview



文章来源: Scope inheritance fails with multiple-named views?