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
Post a Comment