meanjs / mean

MEAN.JS - Full-Stack JavaScript Using MongoDB, Express, AngularJS, and Node.js -
http://meanjs.org
MIT License
4.87k stars 1.98k forks source link

how can i inject a external node module in angular #1935

Open megarton opened 6 years ago

megarton commented 6 years ago

Hi.~ I have a problem. I want to inject flowchart(https://github.com/adrai/flowchart.js) to my meanjs project. but, I don't know how can this.

flowchart isn't an angular module, so I can't inject this module. if I try to build using webpack, is it possible?

PierreBrisorgueil commented 6 years ago

hi,

  angular
    .module(app.applicationModuleName, app.applicationModuleVendorDependencies)
    .constant('flowchart', window.flowchart);

and normally you will be able to call flowchart in your controller

YourController.$inject = ['flowchart'];
function YourController(flowchart) {
...
}