Inside Factory has a variable countF
with value 1:
Factory
app.factory('testFactory', function(){
var countF = 1;
return {
getCount : function () {
return countF;
},
incrementCount:function(){
countF++;
return countF;
}
}
});
Controller
function FactoryCtrl($scope, testService, testFactory)
{
$scope.countFactory = testFactory.getCount;
$scope.clickF = function () {
$scope.countF = testFactory.incrementCount();
};
}
Is it possible to change the value of the countF
variable that is outside the return
in Factory? For example, increase it by% w / w% w / w%?