i just saw this in the angular.js tutorial on the level 2:
(function() {
var app = angular.module('gemStore', []);
app.controller('StoreController', function(){
this.products = gems;
});
app.controller("TabController", function(){
this.tab = 1;
this.setTab = function(selectedTab){
this.tab = selectedTab;
};
});
var gems = [// a lot of code here...]
})();
my doubt is: how does the setTab function alter the value of the TabControler's tab variable? if I use 'this.tab' in the setTab function, the setTab function will be just assigning a variable to it's own internal scope, doesn't it?