javascript - AngularJS - App Controler -


on this website learned write app controller angularjs this:

codecademy version:

app.controller (     'photocontroller',      [         '$scope', 'photos', '$routeparams',           function($scope, photos, $routeparams)           {                 photos.success              (                  function(data)                   {                           $scope.detail = data[$routeparams.id];                     }              );           }     ] ); 

but found possible code this:

my version:

app.controller (     'photocontroller',        function($scope, photos, $routeparams)       {             photos.success          (              function(data)               {                       $scope.detail = data[$routeparams.id];                 }          );       } ); 

both codes work, difference? should use version codecademy or mine? , why? version shorter , see no disadvantages.

the problem version not work minified code. have annotate controllers , other modules working. code work unless has not been minified while minification service/controllers names renamed , break app.

please refer following link more information : https://docs.angularjs.org/guide/di


Comments

Popular posts from this blog

searchKeyword not working in AngularJS filter -

sequelize.js - Sequelize: sort by enum cases -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -