Angularjs minify best practice

前端 未结 7 1596
孤独总比滥情好
孤独总比滥情好 2020-11-22 03:12

I\'m reading http://www.alexrothenberg.com/2013/02/11/the-magic-behind-angularjs-dependency-injection.html and it turned out that angularjs dependency injection has problem

7条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-22 03:58

    Yes, you need to use explicit dependency injection (second variant). But since Angular 1.3.1 you can turn off implicit dependency injection, it's really helpful to solve potential problems with renaming at once (before minification).

    Turning off implicit DI, using strictDi config property:

    angular.bootstrap(document, ['myApp'], {
        strictDi: true
    });
    

    Turning off implicit DI, using ng-strict-di directive:

    
    

提交回复
热议问题