My $stateProvider:
$stateProvider
.state('home', {
url: "/home",
views: {
"header": {templateUrl: "templates/header.html"},
"footer": {
templateUrl : "templates/footer.html",
controllerAs : "footerCtrl",
controller : function($scope){
footerCtrl($scope);
}
}
}
})
function footerCtrl($scope){
console.log($scope);
$scope.var1 = "Fulvio";
this.var2 = "Cosco";
}
template Html:
<div>
{{var1}}
{{footerCtrl.var2}}
</div>
If I try to write ng-controller="footerCtrl" into the DIV no data-binding and I get an error, whereas if I don't write it no errors and no data-binding.