首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >当我使用角度材料日期选择器时,它会停止显示我的页面

当我使用角度材料日期选择器时,它会停止显示我的页面
EN

Stack Overflow用户
提问于 2021-06-11 11:26:14
回答 1查看 57关注 0票数 0

在我的角度项目中添加了角材料包之后,我使用了下面的代码来使用日期选择器。但是当我使用日期选择器代码时,任何HTML页面都会隐藏我的总页面。我是角度方面的新手,所以,我不熟悉这种角度行为。

account.module.ts

代码语言:javascript
复制
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RegisterComponent } from './register/register.component';
import { LoginComponent } from './login/login.component';
import { AccountRoutingModule } from './account-routing.module';
import { ReactiveFormsModule } from '@angular/forms';
import { TestAccountComponent } from './test-account/test-account.component';
import { FogetPasswordComponent } from './foget-password/foget-password.component';
import { ResetPasswordComponent } from './reset-password/reset-password.component';
import { MatDatepickerModule } from '@angular/material/datepicker';
import {MatFormFieldModule} from '@angular/material/form-field';

@NgModule({
  declarations: [
    RegisterComponent,
    LoginComponent,
    TestAccountComponent,
    FogetPasswordComponent,
    ResetPasswordComponent
  ],
  imports: [
    CommonModule,
    AccountRoutingModule,
    ReactiveFormsModule,
    MatDatepickerModule,
    MatFormFieldModule
  ],
  exports: [
    ReactiveFormsModule
  ]
})
export class AccountModule { }

component.html

代码语言:javascript
复制
    <div><mat-form-field class="example-full-width" appearance="fill">
    <mat-label>Choose a date</mat-label>
    <input matInput [matDatepicker]="picker">
    <mat-datepicker-toggle matSuffix [for]="picker">
      <mat-icon matDatepickerToggleIcon>keyboard_arrow_down</mat-icon>
    </mat-datepicker-toggle>
    <mat-datepicker #picker></mat-datepicker>
  </mat-form-field>
</div>

我是新来的。我不知道为什么这段代码会隐藏我的页面?

EN

回答 1

Stack Overflow用户

发布于 2021-06-12 13:29:41

你进口MatIconModule了吗?因为在mat窗体字段中使用mat图标。

如果不是

从“@角/材料/图标”导入{MatIconModule};

进口:.,MatIconModule

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67936179

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档