问题
Imported it in app.module.ts like,
import {NgbModule} from '@ng-bootstrap/ng-bootstrap';
added it in
imports:[NgbModule.forRoot()]
while compiling it is giving
WARNING in ./~/@ng-bootstrap/ng-bootstrap/datepicker/datepicker-input.js
188:12-21 "export 'Renderer2' was not found in '@angular/core'
WARNING in ./~/@ng-bootstrap/ng-bootstrap/modal/modal-window.js
61:12-21 "export 'Renderer2' was not found in '@angular/core'
WARNING in ./~/@ng-bootstrap/ng-bootstrap/popover/popover.js
119:12-21 "export 'Renderer2' was not found in '@angular/core'
WARNING in ./~/@ng-bootstrap/ng-bootstrap/buttons/radio.js
108:12-21 "export 'Renderer2' was not found in '@angular/core'
WARNING in ./~/@ng-bootstrap/ng-bootstrap/buttons/radio.js
212:12-21 "export 'Renderer2' was not found in '@angular/core'
WARNING in ./~/@ng-bootstrap/ng-bootstrap/typeahead/typeahead.js
224:12-21 "export 'Renderer2' was not found in '@angular/core'
WARNING in ./~/@ng-bootstrap/ng-bootstrap/tooltip/tooltip.js
131:12-21 "export 'Renderer2' was not found in '@angular/core'
webpack: Compiled with warnings.
What could be wrong with the initialization, can anyone help? Thank you.
回答1:
I was using
@ng-bootstrap/ng-bootstrap 1.0.0-alpha.26
which is not compatible with angular 2.4.0
tried using 1.0.0-alpha.24
as @yurzui suggested and it is working now.
回答2:
I am using "ng2-bootstrap": "1.1.16", with my Angular 2.4 version and it is working fine. Try that one.
来源:https://stackoverflow.com/questions/44062698/ngbmodule-ng-bootstrap-for-angular2-is-not-working