Last active
December 27, 2015 08:59
-
-
Save kvofreelance/7300285 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!(function(angular){ | |
var fakeServer = angular.module('fakeServer', ['inFoodApp', 'ngMockE2E']); | |
fakeServer.run([ | |
"$httpBackend", | |
function($httpBackend){ | |
var goods = {"4600974008956": {format:'EAN_13', name:'Геркулес', img: '', props: {protein: "12.3", oil:"6.2", carbohydrates: "61.8"}}}; | |
$httpBackend.when("GET", /ingridients\//).respond(function(method, url, params) { | |
var images = []; | |
for(var i = 1; i <= 100; i++) { | |
images.push({ingridient: "Ingridient "+ i, amount: 10, per:"1 кг"}); | |
} | |
return [ 200, JSON.stringify({success: true, ingridients: images}), {} ]; | |
}); | |
/*$httpBackend.when("GET", /^\/barcode\/([0-9]+)$/).respond(function(method, url, params){ | |
var id = url.replace (/.*\/barcode\/([0-9]+)$/, "$1"); | |
var item = goods[id]; | |
if (item) { | |
return [ 200, JSON.stringify({success: true, code: 200, item: item }), {} ]; | |
} | |
return [ 200, JSON.stringify({success: true, code: 404}), {} ]; | |
});*/ | |
$httpBackend.whenGET(/^partials\//).passThrough(); | |
$httpBackend.whenGET(/^.*\/barcode\/([0-9]+)$/).passThrough(); | |
} | |
]); | |
})(angular); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment