AngularJS在符号(@)对象内的locals变量

时间:2015-06-25 10:57:17

标签: javascript angularjs angular-ui-router angular-ui

我正在使用angular-ui-routerangular-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
    });
}

img 现在的问题是,正如您在图片中看到的那样,它是@: Object,现在如果它尝试使用console.log($state.$current.parent.locals.@);,则会出现ILLEGAL TOKEN错误。我的问题是如何访问它,我想访问$scope内的@变量。

0 个答案:

没有答案