javascript - HTTP request to external JSON causes "Error: Unexpected request: GET https://...json" -


hi requesting json file external url https://...json.

when running tests causes unexpected error though did not write tests on functions yet. tests controller fail (at $scope.$digest()).

my code looks follows

service:

angular.module('myapp').service('dealservice',['$http','$location',function($http,$location){   this.deals = function () {     return $http({       method: 'get',       url: 'https://myurl.com/deals.json'     }).then(function (response) {       return response.data;     });   }; }]); 

this returns array take promise such controller:

$scope.dealslanding = [];         dealservice.deals().then(function (deals) {           $scope.dealslanding = deals;         }); 

this seems cause tests fail. error: unexpected request: https://myurl.com/deals.json no more request expected.

what can it?


Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -