user2918057
user2918057

Reputation: 199

Angular module dependency

is possible I start my angular module without some dependency?

it's my angular.module

angular.module("app", [
'ngSanitize', 'ngAnimate', 'ui.router', 'ngMaterial',
'ngRoute', 'ngCookies', 'NgSwitchery',
'ngCkeditor', 'angularFileUpload',
]);

I would like not use, they're required on 1st. loading. 'NgSwitchery', 'ngCkeditor', 'angularFileUpload'

Thank you.

Upvotes: 0

Views: 118

Answers (1)

psel
psel

Reputation: 88

yes, you could use condition to pass dependency.

var dependencyArray = ['dep1', 'dep2'];
if (someCondition) {
    dependencyArray = ['dep1', 'dep2', 'dep3', 'dep4'];
}

  angular.module('app',dependencyArray); 

You might need requireJS if you're trying to load them at different times.

Upvotes: 2

Related Questions