index.html
<body ng-controller="StoreController as s">
<h1 ng-click="s.changeValFunc()">{{s.carname}}</h1>
<h2>{{s.carname}}</h2>
</body>
app.js
var app = angular.module('store', []);
app.controller('StoreController', function() {
this.carname = "Volvo";
this.changeValFunc = function(){
this.carname="BMW";
}
});
Clicking on h1 tag changes {{carname}} for both h1 and h2 to BMW. Isn't it "this" refers to the current element being clicked. Am confused on how controller properties are shared among views.