Is it possible to have multiple startup blocks in angular and grumble?

I am setting up $httpBackend to drown out fake API routes while our API developers are working on them. The problem is that I have to put all my $httpBackend inside my run block. As a result, my run block will become quite large. I would like to know if there is a way to split them into different files, perhaps using several run blocks or even some grunt task to combine them all into one run file.

+5
source share
1 answer

In fact, you can create multiple launch blocks in angular. Just separate each launcher into different files.

Demo

An example of inventing will look like this:

app.js

 angular.module('app', ['ngMockE2E']); 

mock.users.js

 angular.module('app') .run(function($httpBackend) { // implement user api mock }); 

mock.projects.js

 angular.module('app') .run(function($httpBackend) { // implement project api mock }); 
+10
source

All Articles