I want to include ng2-datepicker module in my application. I tried following as mentioned in the readme file.
npm install ng2-datepicker --save
modified systemjs.config.js file to:
.map {
'ng2-datepicker': 'npm:ng2-datepicker',
'moment': 'npm:moment/moment.js'
}
'ng2-datepicker': {
format: 'register',
defaultExtension: 'js'
}
added following line in index.html:
<script src="node_modules/moment/moment.js"></script>
added following line in app.module.ts
import { DatePicker } from 'ng2-datepicker/ng2-datepicker';
declarations: [ AppComponent ,
DatePicker]
I get following error when I load the application:
Error: ReferenceError: require is not defined
at eval (http://localhost:3000/node_modules/ng2-datepicker/ng2-datepicker.js:2:24)
at eval (http://localhost:3000/node_modules/ng2-datepicker/ng2-datepicker.js:7:3)
at ZoneDelegate.invoke (http://localhost:3000/node_modules/zone.js/dist/zone.js:203:28)
Evaluating http://localhost:3000/node_modules/ng2-datepicker/ng2-datepicker.js
Error loading http://localhost:3000/node_modules/ng2-datepicker/ng2-datepicker.js as "ng2-datepicker/ng2-datepicker" from http://localhost:3000/app/app.module.js