In Angular's online free course, I see this:
app.controller('GalleryController', function(){
this.current = 0;
this.setCurrent = function(imageNumber){
this.current = imageNumber || 0;
};
});
but usually the $scope
is passed as an argument to the controller... so, is it really needed?
This is the new "controller as" syntax. Check here : https://docs.angularjs.org/api/ng/directive/ngController
Depends on whether you want to use it inside your controller or not. Since in your controller you are not using $scope, you don't need to pass it as an argument to the controller.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.