我正在使用angular-ui-router
和angular-material
模式。我的州代码正在跟随。
angular.module('app.campaign', [])
.config(['$stateProvider', function($stateProvider) {
$stateProvider
.state("campaigns", {
url: "/campaigns",
...
})
.state("campaigns.add", {
url: "/add",
onEnter: ['$state', '$mdDialog', CampaignAddCtrl]
});
}]);
function CampaignAddCtrl($state, $mdDialog) {
console.log($state.$current.parent.locals); // log output attached image
$mdDialog.show({
controller: 'CampaignAddModal',
templateUrl: 'views/campaigns/add.html',
targetEvent: null,
clickOutsideToClose: false
});
}
现在的问题是,正如您在图片中看到的那样,它是@: Object
,现在如果它尝试使用console.log($state.$current.parent.locals.@);
,则会出现ILLEGAL TOKEN
错误。我的问题是如何访问它,我想访问$scope
内的@
变量。