Reputation:
I am Injecting Dependency to Meanjs Modules For the First time. I see something confusing Dependency Injection at My research
Example(i am Trying to Inject): I need to Inject a spinner to all of my modules
Steps I did:
Do bower install angular-spinkit --save - Done
Add the spinkit Js and Css files to Public/all.js - Done
Do Dependency Injection @ Registering Module -Done
This is my code:
var ApplicationConfiguration = (function() {
// Init module configuration options
var applicationModuleName = 'mean';
var applicationModuleVendorDependencies = ['ngResource', 'ngAnimate', 'ui.router', 'ui.bootstrap', 'ui.utils','angular-spinkit'];//added spinkit
// Add a new vertical module
var registerModule = function(moduleName, dependencies) {
// Create angular module
angular.module(moduleName, dependencies || []);
// Add the module to the AngularJS configuration file
angular.module(applicationModuleName).requires.push(moduleName);
};
return {
applicationModuleName: applicationModuleName,
applicationModuleVendorDependencies: applicationModuleVendorDependencies,
registerModule: registerModule
};
})();
When I did all these things to Inject a Dependency all of my output is gone. What steps I am missing?
Upvotes: 2
Views: 1081
Reputation: 173
for mean.js there you will find **.module.js
under every module of your public/modules
folder. For an example, try users
module. There is a users.client.module.js
file. There you can declare your dependencies. Like:
'use strict';
// Use Applicaion configuration module to register a new module
ApplicationConfiguration.registerModule('users', ['dependency1', 'dependency2', .....]);
Upvotes: 2