I'm not really trying to build anything, just trying to understand this code
I'm so confused that I barely know how to ask this:
What is "this" referring to in these examples?
app.controller("TabController", function(){
this.tab = 1; //this should the property of the controller
this.setTab = function(tab){
this.tab = tab; //this actually works to change the value of the property of the controller (this.tab = 1) why is it able to do that? Isn't "this" applied to the setTab property here?
};
this.isSet = function(tab){
return ( tab === this.tab);
> //same goes for this one as well, is "this.tab" here referencing the controllers tab property or the isSet property. I thought it would have been the isSet
};
});
I'm just going through the angularjs tutorial