Why do angularjs controller declaration have this syntax structure?

后端 未结 5 1945
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-27 23:55

I see the following angularjs controller syntax structure all the time.

angular.module(\'7minWorkout\').controller(\'WorkoutController\', 
[\'$scope\', \'$in         


        
5条回答
  •  一整个雨季
    2020-11-28 00:16

    or you can use following syntax, according to popular angular-styleguide https://github.com/johnpapa/angular-styleguide

    angular.module('7minWorkout')
           .controller('WorkoutController', WorkoutController);
    WorkoutController.$inject = ['$scope', '$interval', '$location'];
    
    function WorkoutController($scope, $interval, $location) {
    
    }
    

提交回复
热议问题