伙计我是角色2材料的新手,如图所示,出现错误。我尝试了很多选项,提到了很多类似的问题,但对我来说没什么用。请帮我解决这个问题。
我正在尝试滑动切换角度材料。我添加了像素材,动画,锤子这样的库,但仍然出现错误
<ang-textfield>...HTML elements...</ang-textfield>[object object]
/* App Module */
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
import {MdButtonModule, MdCheckboxModule, MdCardModule, MdSlideToggleModule, MdTabsModule, MdExpansionModule, MdDialogModule, MdTooltipModule} from '@angular/material';
import { AppComponent } from './app.component';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
FormsModule,
BrowserAnimationsModule,
MdButtonModule,
MdCheckboxModule,
MdCardModule,
MdTabsModule,
MdExpansionModule,
MdDialogModule,
MdTooltipModule,
MdSlideToggleModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
/* App component */
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'app';
color = 'accent';
checked = false;
disabled = false;
}
/* main.ts */
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
import 'hammerjs';
if (environment.production) {
enableProdMode();
}
platformBrowserDynamic().bootstrapModule(AppModule);
.example-card {
width: 200px;
}
.example-header-image {
background-image: url('https://material.angular.io/assets/img/examples/shiba2.jpg');
background-size: cover;
}
.example-h2 {
margin: 10px;
}
.example-section {
display: flex;
align-content: center;
align-items: center;
height: 60px;
}
.example-margin {
margin: 0 10px;
}
答案 0 :(得分:0)
[(ngModel)]="color"
[(ngModel)]="checked"
[(ngModel)]="disabled"
[color]="color"
[checked]="checked"
[disabled]="disabled"
这是因为ngModel不是md-radio-group或md-checkbox的属性。