无法绑定到'primary',因为它不是'button'错误的已知属性

时间:2017-10-05 17:05:15

标签: angular kendo-ui-angular2 asp.net-core-2.0

请帮助!! 我正在尝试使用属性[primary] = 'true'添加一个kendo按钮但是我收到此错误:

  

NodeInvocationException:模板解析错误:无法绑定到   'primary',因为它不是'button'的已知属性。 (“] [primary] =”true“>登录

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>

1 个答案:

答案 0 :(得分:0)

该错误表明无法识别kendoButton指令

需要将ButtonsModule导入到声明使用它的组件的同一模块中。

或者,如果将ButtonsModule导入到另一个模块中,该模块又在声明使用Kendo按钮的组件的模块中导入,则ButtonsModule也需要从导入的公共模块中重新导出(通过导出数组)。

Docs reference