This repository has been archived by the owner on Feb 18, 2021. It is now read-only.
Releases: the-front/angular-mocks-backend
Releases · the-front/angular-mocks-backend
v0.1.7
v0.1.6
Repository moved from [GitHub] erkobridee user to [GitHub] the-front organization
v0.1.5
solve problem with protractor e2e test's execution
review to work with angularjs 1.2.10+
// provider
// You can also just use provide to blanket replace $httpBackend
// with the mock
ngMockBackend.config(
['$provide',
function($provide) {
var obj = new angular.mock.$HttpBackendProvider(),
createHttpBackendMock = obj.$get[1];
// Decorate by passing in the constructor for mock $httpBackend
$provide.decorator('$httpBackend', createHttpBackendMock);
}]);
new service available : getParams
angular.mock.backend.addResource(function(getParams) {
var url = '/user?param1=abc¶m2=def';
var paramMap = getParams(url);
console.log(paramMap.param1); // abc
console.log(paramMap.param2); // def
});
configure backend mock resources with AngularJS $injector
- regexpUrl
isolated in one scope, and added more intelligence, that's allow, configure some regexp using string or RegExp object
- configure backend mock resources with AngularJS $injector
with this, now it's possible to configure resource, like service, factory or controller, with dependency injection
angular.mock.backend.addResource(function($rootScope, httpBackend, regexpUrl) { ... });
or
angular.mock.backend.addResource(
[ '$rootScope', '$httpBackend', 'regexpUrl',
function(scope, httpBackend, regexpUrl) { ... }]);
bugfix - allow angular request load html templates to server
configure allow regexp role on $httpBackend
to find .html at end of some http GET request
$httpBackend.when('GET', regexpUrl(/.html$/)).passThrough();
first version
version number following Semantic Versioning pattern
this library extends angular-mock.js to enable prototype application without some backend support, based on ideias present in this post: Prototype Angular UIs Without A Backend | OpenSource Connections | [jsfiddle] example