Usage with npm and node_modules folder
robeverett opened this issue · comments
There is nothing out there on Google to properly explain how to use this from the node_modules folder in an angularJS app
I've tried var tableResize = require('./node_modules/angular-table-resize/scripts/resize-table-directive');
Says angular cant' be found.
I've tried (function (){
angular.module('myApp').controller('plannedController', plannedController), ['rzTable'];
in my controller.js file.
That would not work. You need to import from the dist
directory instead. Also the use of require
is limited to nodejs and tools like browserify. Be aware that this project is not written as a commonJS module, so your require
statement may or may not work (untested). My suggestion is to use webpack and the ES6 import
statement, or simply use a <script>
tag. Remember also that this angular module must be loaded after AngularJS itself, or you will receive the error you describe above. Lastly, using npm with this project is not different from any other dependencies you may have in your package.json
. Therefore the concrete usage of npm is not specific to this repository, and will not be covered in detail.
Well using the script tag didn't work, so I guess I'll have to try and learn how to use webpack and ES6 import :(