December 2014
Intermediate to advanced
346 pages
6h 14m
English
The ng-strict-di directive is new and extremely simple to understand. When declaring the parent DOM node for your application, if ng-strict-di is included in that element, functions without the minification-safe dependency injection syntax will fail to execute.
Using the ng-strict-di directive is as simple as adding an extra attribute to your ng-app node, as follows:
(app.js)
angular.module('myApp',[])
.controller('Ctrl', function($scope) {});
(index.html)
<div ng-app="myApp" ng-strict-di>
<div ng-controller="Ctrl"></div>
</div>If you try to load the page in your browser, you will be greeted with the following error:
Error: [$injector:strictdi] function($provide) is not using explicit annotation and ...
Read now
Unlock full access