ASP.net Boilerplate - 范围

时间:2015-11-19 14:27:55

标签: javascript asp.net angularjs

我的JS为:

(function () {
    var controllerId = 'app.views.dashboard';
    angular.module('app').controller(controllerId, [
        '$scope', '$stateParams', function ($scope, $stateParams) {
        var vm = this;
        //About logic... 
        var param = $stateParams.dashboardName;
        vm.dashboardName = param; // not working

        console.log(param); //Works
        $scope.dashboardName = param; // not working
    }]);
})();

我的观点定义为:

div ng-controller="app.views.dashboard as vm">
<h1
    Dashboard Detail {dashboardName}
</h1

我遇到这个问题,有什么想法吗?我的状态参数似乎正在通过,但是参数不会填充角度的标记。帮助:)

1 个答案:

答案 0 :(得分:2)

在您的视图中,您应将dashboardName引用为{{vm.dashboardName}}