1
I usually use Angularjs with a structure where I have a Javascript script for each page of my application.
Main dependencies and project settings I define in a file app.js
, which is used on all pages.
Sort of 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 added to the existing module app
a functionality according to the page I upload (I am not using SPA).
Therefore, I need to click on the module app
a specific dependency, for a given script.
In the case of the script js/usuarios/editar.js
need to add ngFileUpload
.
I would not like to added to mine app.js
default, since I will not upload files to all pages of my application, but only in that specific where I use js/usuarios/editar.js
.
It is possible to add a dependency on an angular module that has already been initialized?
From what I’ve seen on some links and websites, you’ll have to declare in the general file even if you only use in a module/controller.
– mutlei
@wrong mutiny. I’ve managed to do this :p
– Wallace Maxters
So... you no longer have an excerpt of the code that allows you to do this?
– mutlei
@mutated if you want to do the please translate, help the community:
– Wallace Maxters
Translated, dear Wallace.
– mutlei