I am using the 'ng-strict-di' directive in my application to protect against failing minification. But now I am getting an error on my directives.
Error: [$injector:strictdi] function($scope, element, attrs) is not using explicit annotation and cannot be invoked in strict mode
How do I explicitly add $scope as a dependency to the anonymous controller function? Here is my directive.
var myApp = angular.module("myApp",[]);
myApp.directive('myDirective', function(){
return{
restrict: 'A',
template: '<h4> {{myController.msg}} </h4>',
controller: function($scope, element, attrs){
$scope.myController = this;
this.msg = "Hello world";
};
});
I tried:
var myApp = angular.module('myApp ', ['$scope'])
But I get this error: Error: [$injector:modulerr] Failed to instantiate module