I had some difficulties getting ng-bootstrap running with Angular CLI which uses Webpack. There is an open issue to add instructions and a demo for CLI, but I decided to fill the gap on my blog (contact me on Twitter if you’d like to use this in ng-bootstrap and I can make a PR).
"@angular/common": "2.2.1", "@ng-bootstrap/ng-bootstrap": "^1.0.0-alpha.14", "bootstrap": "^4.0.0-alpha.5"
If you don’t already have Angular CLI setup, run these commands in the command line.
npm install -g angular-cli
ng new myApp
npm install --save @ng-bootstrap/ng-bootstrap
npm i [email protected] --save
'../node_modules/bootstrap/dist/css/bootstrap.css' to the
styles in the angular-cli.json
My mistake was adding
'../node_modules/bootstrap/dist/js/bootstrap.js' to the
scripts in the angular-cli.json.
I was getting a strange error.
VM35625:9 Uncaught TypeError: Cannot read property 'Observable' of undefined(…)webpackUniversalModuleDefinition @ VM35625:9(anonymous function) @ VM35625:10module.exports @ scripts.bundle.js:28369 @ scripts.bundle.js:6__webpack_require__ @ inline.bundle.js:53694 @ scripts.bundle.js:37__webpack_require__ @ inline.bundle.js:53webpackJsonpCallback @ inline.bundle.js:24(anonymous function) @ scripts.bundle.js:1
Please consider using Brave and adding me to your payment ledger. Then you won't have to see ads!