could you please tell me what is difference between provider and factory ?I know the difference between factory and service.But could you please tell me in simple language what is difference between in provider and factory . I make a demo in which i use both but work fine but what is difference mean when I use provider and when I use factory ? here is my code http://codepen.io/anon/pen/NqWRNw
var app =angular.module('ionicApp',['ionic']);
app.factory('fac',function(){
var name;
return {
getname :function(){
return this.name;
},
setName:function(name){
console.log(name)
this.name=name;
console.log( this.name)
}
}
});
app.controller('cntr',function($scope,fac,pro){
fac.setName('test');
console.log(fac.getname()+"--");
console.log("pro============")
pro.setName('protest');
console.log(pro.getname()+"--");
})
app.provider('pro',function(){
var name;
return {
$get :function(){
return {
getname:function(){
return this.name;
},
setName:function(name){
this.name=name;
}
}
}
}
});