Hi,
why not targeting a simple plunker local json fle like this :
http://plnkr.co/edit/euovbo?p=info ?
Marc
On 04/04/2014 11:02, abe wrote:
> I have a service I am attempting to stub on a plunkr:
>
> app.service('awesomeService', ['$http','$httpBackend', function(http,
> httpBackend){
> list = [{name: 'foo'}, {name: 'bar'}, {name: 'bazz'}];
> httpBackend.whenGET('/foo').respond(list);
> service = {}
> service.getList = function(){
> var promise = $http.get('/foo').then(function(response){
> return(response.data);
> });
> return(promise);
> }
> return(service);
> }]);
>
> I would like to be able to show a demo of a service without having to worry
> about a real backend. Unfortunately, this triggers the following error:
>
> TypeError: Object function (method, url, post, callback, headers,
> timeout, withCredentials, responseType) {
> var status;
> $browser.$$incOutstandingRequestCount();
> url = url || $browser.url();
>
> if (lowercase(method) == 'jsonp') {
> var call...<omitted>... } has no method 'whenGET'
> at new <anonymous>
> (http://run.plnkr.co/DLBqUerP2Tg7stbd/script.js:17:19)
> at invoke (http://code.angularjs.org/1.2.15/angular.js:3805:17)
> at Object.instantiate
> (http://code.angularjs.org/1.2.15/angular.js:3816:23)
> at Object.<anonymous>
> (http://code.angularjs.org/1.2.15/angular.js:3684:24)
> at Object.invoke
> (http://code.angularjs.org/1.2.15/angular.js:3805:17)
> at http://code.angularjs.org/1.2.15/angular.js:3647:37
> at getService (http://code.angularjs.org/1.2.15/angular.js:3768:39)
> at invoke (http://code.angularjs.org/1.2.15/angular.js:3795:13)
> at Object.instantiate
> (http://code.angularjs.org/1.2.15/angular.js:3816:23)
> at http://code.angularjs.org/1.2.15/angular.js:6922:28
>
> How can I stub server endpoints on a plunkr (or jsfiddle for that matter)
> demo by using `$httpBackend` or otherwise?
>
> Demo: http://plnkr.co/edit/et9dxXR3cPUuthp7PxBN?p=preview
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.