newaeonweb / generator-angm

AngularJS Yeoman Generator to help you getting started with a new project based on AngularJS and Angular Material to build large scale applications.
72 stars 24 forks source link

third party component dependency injection issue #16

Open ChiragHindocha opened 7 years ago

ChiragHindocha commented 7 years ago

Hi @newaeonweb ,

I would like to know how can I inject 3rd party dependencies into my app? For eg. let's say I am using https://github.com/daniel-nagy/md-data-table Now if I inject the dependency 'md.data.table' in my app.js, and if I create a new module by yo angm:angm-module, the 3rd party dependency 'md.data.table' that I injected previously is removed. I noticed the src code updateAppFile function, it gets the modules from the config & when I add a 3rd party bower component, it is niether added in the .yo-rc.json file nor does it exists in the _app.js file & hence I understand why the dependency gets removed when I add a new module.

So is app.js the wrong place to inject 3rd party dependencies ? What's the correct approach ?

I guess there should be an object array named dependencies in the .yo-rc.json which should be updated when I add/remove a bower component into my app & when app.js gets overwritten it should consider _app.js + modules (in .yo-rc.json file) + dependencies (in .yo-rc.json file)
Do I need to change the source file to support this or is there some another approach to achieve this?

Please advice. Thanks in advance.

ChiragHindocha commented 7 years ago

Or I can even create a module say vendor & inject all 3rd party dependecies into vendor module & injecting vendor in app.js should solve my purpose. Please advice.

newaeonweb commented 7 years ago

@ChiragHindocha . sorry for delay. For now you need to add the dependencies manually to both files.