AngularJS initialise backendless testing

I have AngularJS + RequireJS app. My task is to create a backendless version for UI development purposes. So a version where some/all HTTP requested are mocked. The desired user flow is:

  1. User goes to /debug to initialise a backendless version.
  2. User can use the app with HTTP requests being mocked.

I'm trying to use ngMockE2E.$httpBackend. But I can't find any information on how to inject it into already bootstrapped app. Following most of googled examples I'm trying to create a new module and bootstrap that one:

(function(ng, mod, _, $, undefined){
    'use strict';

    mod.run(function($httpBackend) {

    })
}(angular, angular.module('rexBackendless', ['rex', 'ngMockE2E']), _, jQuery));

angular.bootstrap(document, ["rexBackendless"]);

But this gives me "Error: ng:btstrpd App Already Bootstrapped with this Element". Any ideas on how to develop this task?

Answers


Drop the call to bootstrap():

var app = angular.module('rexBackendless', ['rex', 'ngMockE2E']);

app.run(function($httpBackend) {
    $httpBackend.whenGET('yo').respond('wat');
    // ...
});

Need Your Help

How do I modify class declaration syntax correctly with Roslyn?

c# roslyn

I have a method below to modify class declaration syntax. I added two StatementSyntax attributes to all methods in the class, and then I will save that class to my solution. Everything is good, but...

incremental average using excel

excel excel-vba moving-average visual-studio-macros vba

I need to take the average of every 2 point increment, my data is in columns "a", as an example , and the average in column "b"