A
A
Alexey Kuzmin2016-03-07 19:01:38
JavaScript
Alexey Kuzmin, 2016-03-07 19:01:38

How to load dependencies asynchronously in AngularJS?

Good afternoon
There is a SPA on AngularJS. Pts heavy logic on a couple of pages - third-party libraries are required: Google Maps, tables, etc. Because of this, you have to connect all JS with libraries in index.html and add dependencies to app.js :

angular.module('forms', ['ui.select2', 'ui.select2', 'ngFileUpload', 'ngMap', ....])

I want controllers and dependencies to be pulled up as needed: for each url or in the controller. How to do it? (I'd be happy to see links with ready-made example project structures) I watched angular-seed and even ran index-async.html after reading the readme, but I still did not understand how to include dependencies in the controller, and not in app.js

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Arthur, 2016-03-07
@DrMartiner

webpack will solve your problems

A
Andrew, 2016-03-08
@Kragoth

In order to do this, you first need to finish what you started, and judging by the fact that the posts appear here, the brick did not fall on your head, as you warned from the first day. Otherwise, your actions fall under the definition of "fraud", I thought they just took a scan of your passport just like that? Turned off the phone and free?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question