Circular dependency angularjs -
can tell me circular dependency in following code?
var homeapp = angular.module("homeapp",['nganimate', 'ui.bootstrap']); 'use strict'; homeapp.factory('admindashboardservice', ['$http', '$q', function($http, $q){ return { 'response': function(response) { // on success console.log("yes command comes here"); return response; }, getallholidays: function(monthyeararrayforholidaylist) { console.log("for full list of holidays list length: "+monthyeararrayforholidaylist.length); var ismonthly="no"; return $http.get('/tasktrac/holiday/getholiday/ismonthly/'+ismonthly+'/'+monthyeararrayforholidaylist) .then( function(response){ return response.data; }, function(errresponse){ //console.error('error while fetching holiday'); return $q.reject(errresponse); } ); }, }]); homeapp.config(['$httpprovider', function($httpprovider) { $httpprovider.interceptors.push('admindashboardservice'); }]);
i stuck @ point please me favour in resolving issue. error got on browser please click here see error thank you..!!
a $http interceptor not declare $http dependency!
inject $injector:
homeapp.factory('admindashboardservice', ['$injector', '$q', function($injector, $q){ return { 'response': function(response) { // on success console.log("yes command comes here"); return response; }, getallholidays: function(monthyeararrayforholidaylist) { console.log("for full list of holidays list length: "+monthyeararrayforholidaylist.length); var ismonthly="no"; return $injector.get("$http").get('/tasktrac/holiday/getholiday/ismonthly/'+ismonthly+'/'+monthyeararrayforholidaylist) .then( function(response){ return response.data; }, function(errresponse){ //console.error('error while fetching holiday'); return $q.reject(errresponse); } ); }, }]);
Comments
Post a Comment