I have been diligently working on updating my Controllers, Factories, and Directives to align with the recommended Angular Style Guide for Angular Snippets.
So far, I have successfully refactored the Controllers and Factories to comply with the new style guide, but I am facing challenges with the Directives.
Unknown provider: $scopeProvider <- $scope <- platformHeaderDirective
The revised Directive structure encountering errors:
(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 () {
}
})();
Comparison with the functional old Directive without errors:
(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) {
/** Initialize platformHeader scope */
// var vs = $scope;
}]
}
});
})();