AngularJS controllers and “use strict”

前端 未结 4 724
野趣味
野趣味 2021-02-01 16:18

I recently started using JSHint and it is requiring me to use the function form of \"use strict\". Since then, AngularJS throws an error:

\"Error: Argument \'webAddressC

4条回答
  •  南笙
    南笙 (楼主)
    2021-02-01 16:52

    Have you tried writing 'use strict' outside and before (function()

    "use strict"; // <-- add it here
    (function () {
        //"use strict"; <-- remove from here
    
        function webAddressController($scope, $rootScope, web_address_service) {
             // Do things
        }
    
    }());
    

    My answer is based on the files that I have seen generated by Yeoman

提交回复
热议问题