angularjs - Angular Control not working after minified JS file? -
i new angularjs. have create new application in vs2012 using angularjs. have apply minification javascript file, after minification binding in not working me. because $scope keyword angular understand convert a.
please let me know how apply minification angularjs file ?
from http://docs.angularjs.org/tutorial/step_05:
since angular infers controller's dependencies names of arguments controller's constructor function, if minify javascript code phonelistctrl controller, of function arguments minified well, , dependency injector not able identify services correctly.
to overcome issues caused minification, assign array service identifier strings $inject property of controller function, last line in snippet (commented out) suggests:
phonelistctrl.$inject = ['$scope', '$http'];
there 1 more way specify dependency list , avoid minification issues — using bracket notation wraps function injected array of strings (representing dependency names) followed function injected:
var phonelistctrl = ['$scope', '$http', function($scope, $http) { /* constructor body */ }];
both of these methods work function can injected angular, it's project's style guide decide 1 use.
Comments
Post a Comment