I usually use AngularJS with a framework where I have a Javascript script for each page of my application.
The main dependencies and project settings I define in a app.js
file, which is used on all pages.
More or less like this:
// 'js/app.js'
angular.module('app', ['ngAnimate', 'ui.validate'])
// 'js/usuarios/listar.js'
angular.module('app').controller('UsuariosController', function () {
// resto do código
})
That is, I always add to the existing module app
a functionality according to the page that I load (I'm not using SPA).
So, I need to load a specific dependency for a particular script into the app
module.
In the case of script js/usuarios/editar.js
, I need to add ngFileUpload
.
I would not like to be added to my default app.js
, since I will not upload files on all pages of my application, but only in that specific where I use js/usuarios/editar.js
.
Is it possible to add a dependency on an angle module that has already been initialized?