来自服务器的dataload上的Angularjs微调器

时间:2014-09-26 14:23:02

标签: angularjs spinner

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div class="spinner-modal" ng-show="spinning">
            <div class="spinner">
                <i class="fa fa-spinner fa-5x fa-spin"></i>
            </div>
</div>

这是我的控制器

controllers.controller('CenterCtrl', ['$scope', '$rootScope', '$sce', 'recommendationService','SpinnerModule', 
        function ($scope, $sce, $rootScope, recommendationService,SpinnerModule) {
        $scope.getRecommendation = function() {
            $scope.spinning = true;
            $scope.$broadcast("spinner:start", {username: $scope.user.username });
            $scope.$broadcast("myEvent", {username: $scope.user.username });
            recommendationService.getNext().then(function(response) {
                console.log(response.data);
                $scope.recommendation = $sce.trustAsHtml(response.data);
                console.log($scope.recommendation);
            });
        };

        $scope.getRecommendation();

来自建议的数据显示没有微调器。当我添加这个微调器

我得到一个错误说 &#34;错误:[$ injector:unpr]未知提供者:SpinnerModuleProvider&lt; - SpinnerModule&#34; 我是新来的,请帮助我。感谢

1 个答案:

答案 0 :(得分:1)

您的依赖项顺序错误

['$scope', '$rootScope', '$sce', 'recommendationService','SpinnerModule', 
        function ($scope, $sce, $rootScope, recommendationService,SpinnerModule)
$ sce $ rootscope 没有按照从注释到控制器的相同顺序定义,角度将正确的依赖项注入到你的控制器。