2017-07-14 45 views
0

我導入了datepicker,它顯示正常。在ngx-bootstrap中導入組件拋出'不是已知元素'的錯誤

但是,當我嘗試導入鍵入或按鈕或任何東西,我得到<whatever> is not a known element錯誤。

我在做什麼是進口的app.module這樣的模塊:

import {DatepickerModule} from 'ngx-bootstrap/datepicker'; 
import { TypeaheadModule } from 'ngx-bootstrap/typeahead'; 
import { ButtonsModule } from 'ngx-bootstrap/buttons'; 
// also tried: 
// import { DatepickerModule, TypeaheadModule... } from 'ngx-bootstrap'; 
// ..but again no luck 
... 
imports: [ 
    DatepickerModule.forRoot(), //only this works 
    TypeaheadModule.forRoot(), 
    ButtonsModule.forRoot(), 
    ...] 

然後在我的history.module與唯一的區別在於.forRoot()現在省略了同樣的方式。

然後在父歷史組件的子組件我有:

<span *ngIf="showFilters" class="value bootstrap-iso" > 
    <div style="display:inline-block;"> 
    <datepicker 
     [(ngModel)]="dt" 
     [datepickerMode]="'month'" 
     [showWeeks]="false" 
     [dateDisabled]="dateDisabled" 
     [maxDate]="today"> 
    </datepicker> 
    </div> 
</span> 

其工作,但如這些不工作:

<typeahead [typeahead]="'documents'"></typeahead> 
<btnCheckbox></btnCheckbox> 

,如果我有沒有關係ngModel或其他屬性,我總是得到不是已知的元素錯誤。所以我認爲它與我的進口,我的命名或somethng有關,但老實說我看不到缺少的東西。

編輯:採用了棱角分明4,"@angular/cli": "1.1.1","ngx-bootstrap": "^1.7.1","bootstrap": "^4.0.0-alpha.6","typescript": "~2.3.3"

回答

0

嗯,我實際上是在增加的文檔中的template部分中所示的input

所以此工程:

<input [(ngModel)]="selected" 
    [typeahead]="documents" 
    class="form-control"> 

因爲文檔中提到SelectorExported as我想我們應該使用這些值。我認爲這些模板只是展示了這些組件如何在引擎蓋下工作。

相關問題