AngularJS重置指令数据并从主控制器刷新模板

时间:2016-03-03 22:24:01

标签: angularjs angularjs-directive

这是我的指示:

app.directive('gwQuestionSet', function (QuestionSetFactory, _) {

    'use strict';
    return {
        restrict: 'A',
        templateUrl: '/Classification/templates/question-set.html',
        scope: {
            'gwPlQuestionSet': '='
        },
        controller: ['$rootScope', '$scope', '$http', function ($rootScope, $scope, $http, _) {

            var set = $rootScope.QuestionSets;
            var getquestionSets = QuestionSetFactory.create();

            var questionSets = getquestionSets.getQuestionSetViewModel(set);

            $scope.questionSets = questionSets;

        }]
    };
});

我的问题是,如果我从主控制器重置$ rootScope.QuestionSets的数据,是否可以撤销指令控制器中的这些代码并刷新模板?

0 个答案:

没有答案