So, my impression is that Angularjs can be a bit verbose and I would like some clear understanding of what the main differences are between the following functionality AND when are they used. I 'feel' I understand, but lines are a bit vague & ethereal so I want others to clarify.
What is the difference in usage between: They seem interchangeable in their duties, and usage.
A. Service
B. Factory
C. Provider
What is the difference between a module.controller vs. module.directive.controller? ie:
var app = angular.module("someApp",[]);
app.controller("someCtrl1", function(){
// some code
});
and this usage, when it sits inside a directive
app.directive("someDirective", function() {
return {
restrict: 'E',
template: '<p>Hello {{name}}!</p>',
controller: function($scope, $element){
$scope.name = $scope.name + "post1 ";
},
link: function(scope, el, attr) {
scope.name = scope.name + "post2 ";
}
}
})
I am a little hazy on the "controller" inside the return of the directive. What is this convention, in more detail?