I am developing a page with Angular, and have an init() method in my controller. The code is as follows:
var filtersController = ['$scope', '$http', function ($scope, $http) {
$scope.init = function () {
$http({
method: 'GET',
url: '/json-tags-test',
cache: true
}).success(function (data, status, headers, config) {
// this callback will be called asynchronously
// when the response is available
}).error(function (data, status, headers, config) {
// called asynchronously if an error occurs
// or server returns response with an error status.
});
};
}];
It is just a call to a simple JSON file.
My HTML is as follows:
<div class="container main-frame" ng-app="projectsApp" ng-controller="filtersController" ng-init="init()">
</div>
For some reason, this get call gets call twice every time I load the page. Is this standard behaviour?
Many thanks,
Dash