Warum ist meine Richtlinie werfen "Fehler: $Injektor:unpr Unbekannten Anbieter"

Habe ich arbeiten auf die Umgestaltung meiner Controller, Fabriken und Richtlinien für die empfohlene Angular-Stil-Guide für Winkel-Snippets.

Ich habe die Controller und Fabriken arbeiten richtig mit dem neuen Stil, aber nicht den Richtlinien.

Unknown provider: $scopeProvider <- $scope <- platformHeaderDirective

Die neue Richtlinie style mit Fehler:

(function() { "use strict";

    angular
        .module('platformHeaderDirectives', [])
        .directive('platformHeader', directive);
    directive.$inject = ['$scope'];
    /* @ngInject */
    function directive ($scope) {
        var directive = {
            templateUrl : "header/platform_header/platformHeader.html",
            restrict    : "E",
            replace     : true,
            bindToController: true,
            controller: Controller,
            controllerAs: 'vm',
            link: link,
            scope: {
            }
        };
        return directive;
        function link(scope, element, attrs) {

        }
    }
    /* @ngInject */
    function Controller () {

    }
})();

Meine alten arbeiten-Richtlinie, die nicht werfen Fehler:

(function() { "use strict";

    angular.module('platformHeaderDirectives', [])

    .directive('platformHeader', function() {
        return {
            templateUrl : "header/platform_header/platformHeader.html",
            restrict    : "E",
            replace     : true,
            scope       : false,
            controller  : ['$scope',
                           function($scope) {

                /** Init platformHeader scope */
                //var vs = $scope;

            }]
        }
    });

})();
  • Die Richtlinie nimmt nicht scope Injektion. Bitte entfernen Sie es und versuchen.
  • ah! Das war es!!! Danke 🙂 Hmm ich muss das Ausgabe-Anfrage für das repo
InformationsquelleAutor Leon Gaban | 2015-05-16
Schreibe einen Kommentar