angularjs - Can a controller inherit scope from a parent controller when using ui-router -
i have following:
var admin = { name: 'admin', url: '/admin', views: { 'nav-sub': { templateurl: '/content/app/admin/partials/nav-sub.html', controller: function ($scope) { $scope.message = "hello"; } } }, controller: ['$scope', function ($scope) { $scope.message = "hello"; }] } var subject = { name: 'subject', parent: admin, url: '/subject', views: { 'grid@': { templateurl: '/content/app/admin/partials/grid-subject.html', controller: 'admingridsubjectcontroller', } } };
i admingridsubjectcontroller know $scope.message value seems not know it. there doing wrong?
stapp.controller('admingridsubjectcontroller', ['$scope', function ( $scope ) { var = $scope.message; }]);
in order access scope
of parent controller in angular ui router use:
$scope.$parent
then parent scope freely available you.
Comments
Post a Comment