javascript - Browserify with Angular and non-CommonJS libraries -
i trying convert angular project use commonjs , browserify. issue though of angular modules not in commonjs format. best way include them?
for example, in app-js, have:
angular .module('app', ['ngroute', 'ngresource', 'ngcookies', 'ngsanitize', 'ngmessages', 'flash', 'smart-table', 'ui.bootstrap', 'isteven-multi-select'])
so of these, can npm version , add var ngroute = require(ng-route)
, etc. of modules, 'isteven-multi-select' not have commonjs version. how can include in code?
how make them commonjs:
add in file :
require('./isteven-multi-select');
and create isteven-multi-select.js file in same directory (you can change directory in require
change path).
now in isteven-multi-select.js add @ top:
module.exports = angular.module('isteven-multi-select',[]) //rest of code, example .service('someservice', function () {...}) .controller('somecontroller', function() {...})
Comments
Post a Comment