> jsfiddle is awesome, it really saves us a lot of time. The only problem
> is, that it's not that easy to write an example with xhr requests...
> Angular has a mock version of $httpBackend, which allows you to specify
> your fake backend - that's useful for testing, but we can use it with
> jsfiddle as well.
There is also this:
http://doc.jsfiddle.net/use/echo.html
By the way, I can't see the source code (HTML or JavaScript) in jsFiddle
since a few weeks ago (with Chrome or IE). Anyone have an idea why?
Regards
Alex
--To view this discussion on the web visit https://groups.google.com/d/msg/angular/-/l9EBS35maA0J.
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To post to this group, send email to ang...@googlegroups.com.
To unsubscribe from this group, send email to angular+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/angular?hl=en.
angular.module('MainModuleDev', ['MainModule', 'ngMockE2E']).run(function($httpBackend, $resource) {$httpBackend.whenGET(/^\/js\/spec\/mocks.*\//).passThrough();$httpBackend.whenGET('https://api.site.com/e2e/test/model1').respond($resource("/js/spec/mocks/model1.json").get());$httpBackend.whenGET('https://api.site.com/e2e/test/model2').respond($resource("/js/spec/mocks/model2.json").query());$httpBackend.whenGET(/.*/).passThrough();});
You can check out the peepcode-tunes app which can be easily modified to work with the mock:
just edit the index.html to load tunesAppFake instead of tunesApp module and uncomment the module in the Tunes.js
/i
On Tue, Apr 3, 2012 at 2:22 PM, Mykhailo Kotsur wrote:
Hi!Scanning through http://docs-next.angularjs.org/api/angular.module.ngMockE2E.$httpBackend and old threads 3rd time and some questions are still not clear:1. How can I configure $httpBackend from spec file? Or does it require changes in application code?2. If It does, is there some example or 'best practice' of doing so?3. If not, then I'm confused even more because myAppDev module seems to be never initialized if configured from jasmine spec.Also I feel real lack of documentation/examples on this topic which I'd be happy to help to cover, but need to understand this magic first :-)Mike
On Monday, 20 February 2012 02:39:07 UTC+1, Vojta Jína wrote:Hey folks,jsfiddle is awesome, it really saves us a lot of time. The only problem is, that it's not that easy to write an example with xhr requests...Angular has a mock version of $httpBackend, which allows you to specify your fake backend - that's useful for testing, but we can use it with jsfiddle as well.Here is a simple example how to do it http://jsfiddle.net/vojtajina/DQHdk/V.--To view this discussion on the web visit https://groups.google.com/d/msg/angular/-/l9EBS35maA0J.
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group, send email to angular+unsubscribe@googlegroups.com.
Yep, that worked.Now I have:angular.module('MainModuleDev', ['MainModule', 'ngMockE2E']).run(function($httpBackend, $resource) {$httpBackend.whenGET(/^\/js\/spec\/mocks.*\//).passThrough();$httpBackend.whenGET('https://api.site.com/e2e/test/model1').respond($resource("/js/spec/mocks/model1.json").get());$httpBackend.whenGET('https://api.site.com/e2e/test/model2').respond($resource("/js/spec/mocks/model2.json").query());$httpBackend.whenGET(/.*/).passThrough();});and MainModuleDev as ng-app in HTML. It allows to use external *.json files as mocks.I think it's kind of ok for development to have fer URLs mocked and rest of them passed through, but what is suggested way to deploy application? Manual (scripted) substitution ng-app="MainModuleDev" -> ng-app="MainModule" ?
/i
To unsubscribe from this group, send email to angular+u...@googlegroups.com.