I'm facing an issue where a controller seems to be executing twice, even though I cannot find any duplicates in my files. Running a case sensitive search through my code only reveals one instance of the controller in route configuration and the actual controller file.
Route config:
$routeProvider.when('/cb159e1ec61d0613f10ab397d8bd6782',{
templateUrl: view+'passwordreset.html',
controller:'passwordreset'
});
Controller:
App.controller('passwordreset',['$scope','$http',
function($scope,$http){
$scope.token='asdf'
console.log($scope.token); // <-- logs 2x to console
}]);
passwordreset.html
:
<div class="row">
<div class="small-12 columns">
<fieldset class="content-box">
password reset {{token}}
</fieldset>
</div>
</div>
In addition, I have tried creating a new route but the issue persists. I've also cleared my cache. Interestingly, some controllers execute once while others execute twice when I put an alert in them.
Here's another example:
//route config
$routeProvider.when('/', {
templateUrl: view+'home',
controller:'Home'
});
//template
<div ng-controller="testing">a</div>
//controller
Lmu.controller('Home',function($scope){
$scope.home='home';
alert($scope.home); <-- alerts 2x (two scopes for Home controller are created)
});