Scope inheritance fails with multiple-named views?
Asked Answered
G

1

1

It breaks when moving from (Plnkr):

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

To (Plnkr):

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

Specifically I have a 'sidebar' state I want to add as a secondary state to 'home'.

Glauce answered 17/6, 2014 at 13:49 Comment(0)
G
1

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

Glauce answered 17/6, 2014 at 14:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.