2017-10-05 59 views
0

請幫助! 我試圖與物業[primary] = 'true'加入劍道按鈕,但我得到這個錯誤:無法綁定到「主」,因爲它不是「按鈕」的已知屬性錯誤

NodeInvocationException: Template parse errors: Can't bind to 'primary' since it isn't a known property of 'button'. (" ][primary]="true">Log in 

app.module.browser.ts

import { NgModule } from '@angular/core'; 
import { BrowserModule } from '@angular/platform-browser'; 
import { AppModuleShared } from './app.module.shared'; 
import { AppComponent } from './components/app/app.component'; 

import { CommonModule } from '@angular/common'; 
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; 
import { InputsModule } from '@progress/kendo-angular-inputs'; 
import { ButtonsModule } from '@progress/kendo-angular-buttons'; 

@NgModule({ 
    bootstrap: [ AppComponent ], 
    imports: [ 
     CommonModule 
     , BrowserModule 
     , AppModuleShared 
     , BrowserAnimationsModule 
     , InputsModule 
     , ButtonsModule 
    ], 
    providers: [ 
     { provide: 'BASE_URL', useFactory: getBaseUrl } 
    ] 
}) 
export class AppModule { 
} 

export function getBaseUrl() { 
    return document.getElementsByTagName('base')[0].href; 
} 

HTML

<div class="BodyBG"> 
    <table style="width: 100%;"> 
     <tr> 
      <td> 
       <div id="login"> 
        <h4>LIS 2.0</h4> 
        <div id="divOldLogin"> 
         <form (ngSubmit)="login(fLogin)" #fLogin="ngForm"> 
          <fieldset id="inputs"> 
           <input kendoTextBox id="txtUsername" name="username" type="text" placeholder="Username" autofocus="autofocus" required="required" ngModel/> 
           <div id="password"> 
            <input kendoTextBox id="txtPassword" name="password" type="password" placeholder="Password" required="required" ngModel /> 
           </div> 
           <button kendoButton type="submit" id="btnSubmit" (click)="login()" [primary]="true">Log in</button>&nbsp; 
          </fieldset> 
         </form> 
        </div> 
       </div> 
      </td> 
     </tr> 
    </table> 
</div> 

回答

0

錯誤提示kendoButton指令未被識別

ButtonsModule需要在聲明使用它的組件的相同模塊中導入。另外,如果ButtonsModule在另一個模塊中導入,而該模塊又被聲明爲使用Kendo按鈕的組件中導入的模塊,那麼ButtonsModule也需要從其導入的公共模塊中重新導出(通過exports數組)。

Docs reference

+0

**謝謝!! ** – Kawatron

相關問題