Angular5和ngx-bootstrap

时间:2019-02-01 20:47:39

标签: javascript angular angular5

在构建项目后,我遇到了使用ngx-bootstrap的Typeahead的问题:

index.js:... Error: StaticInjectorError(AppModule)[TypeaheadDirective -> ComponentLoaderFactory]: 
  StaticInjectorError(Platform: core)[TypeaheadDirective -> ComponentLoaderFactory]: 
    NullInjectorError: No provider for ComponentLoaderFactory!

package.json中的版本如下:

"@angular/cli": "^1.7.4",
"@angular/compiler-cli": "^5.2.11",
"ngx-bootstrap": "^2.0.2",
"typescript": "^2.4.2",

在我的app.component中,它的导入方式如下:

import { TypeaheadModule } from 'ngx-bootstrap/typeahead';

@NgModule({
    imports: [
        ...,
        TypeaheadModule.forRoot(),
    ],
....

0 个答案:

没有答案