AngularJs: kontroler jest wywoływany dwukrotnie za pomocą $ routeProvider
Trasy modułu:
var switchModule = angular.module('switchModule', []);
switchModule.config(['$routeProvider', function($routeProvider) {
$routeProvider.
when('/build-content', {templateUrl: 'build-content.html', controller: BuildInfoController});
}]);
Kontroler:
function BuildInfoController($http, $scope){
alert("hello");
}
HTML:
<html ng-app="switchModule">
...
<body>
<ul>
<li><a href="#build-content"/></a></li>
</ul>
<div class="ng-view"></div>
</body>
...
Za każdym razem, gdy klikam hiperłącze „”, „BuildInfoController” zostanie wywołany dwukrotnie. Czy coś mi umyka?