lundi 2 février 2015

Controller function being called but not executing AngularJS


Vote count:

0




I am trying to call a controller from the view. I used Chrome dev tool and I know that the controller is being called, but not execute.


I don't really where to look at to make it work. Any advices about how to debug that kind of code?


Controller:



angular.module('guideController').controller('scheduleController', ['$scope', 'API', function($scope, API) {

$scope.getChannelSchedule = function(channelId) {
API.getScheduleForChannelId(channelId)
.success(function(schedule) {
$scope.schedule = schedule;
})
.error(function(error) {
//ERROR management
});
};

}]);


Factory:



angular.module('guideService', [])
.factory('API', ['$http', function($http) {
return {
getScheduleForChannelId: function(channelId) {
return $http.get('http://localhost:5000/schedule/' + channelId);
}
};
}]);


and the view:



<div class="container" ng-controller="scheduleController">
test {{scheduleController.getChannelSchedule}}
</div>


asked 47 secs ago







Controller function being called but not executing AngularJS

Aucun commentaire:

Enregistrer un commentaire