大佬教程收集整理的这篇文章主要介绍了angular – MatDialog无法正确显示,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
import {Component,Inject,OnInit} from '@angular/core'; import {Router} from '@angular/router'; import {AuthenticationservicE} from '../../../service/authentication.service'; import {MAT_DIALOG_DATA,MatDialog,MatDialogRef} from '@angular/material'; @Component({ SELEctor: 'app-home',templateUrl: './home.component.html',styleUrls: ['./home.component.css'] }) export class HomeComponent { constructor(private router: Router,public dialog: MatDialog) { } openDialog(): void { const dialogRef = this.dialog.open(CreateGroupDialogComponent); } } @Component({ SELEctor: 'app-create-group-dialog',template: ` <span>Hello World!</span> ` }) export class CreateGroupDialogComponent { constructor(public dialogRef: MatDialogRef<CreateGroupDialogComponent>) { } }@H_197_8@但是,即使按下相应按钮时对话框出现,我得到的是:
我不知道问题是什么.为什么模态没有正确绘制?
import { BrowserModule } from '@angular/platform-browser'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { NgModule } from '@angular/core'; import { MatDialogModule,MatButtonModule } from '@angular/material'; import { AppRoutIngModule } from './app-routIng.module'; import { AppComponent } from './app.component'; import { LoginComponent } from './login/login.component'; import { HomeComponent,DialogoverviewExampleDialogComponent } from './home/home.component'; @NgModule({ declarations: [ AppComponent,LoginComponent,HomeComponent,DialogoverviewExampleDialogComponent ],imports: [ BrowserModule,BrowserAnimationsModule,AppRoutIngModule,MatDialogModule,MatButtonModule ],providers: [],bootstrap: [AppComponent],entryComponents: [ DialogoverviewExampleDialogComponent ] }) export class AppModule { }@H_197_8@重复Angular2 material dialog has issues – Did you add it to @NgModule.entryComponents?
以上是大佬教程为你收集整理的angular – MatDialog无法正确显示全部内容,希望文章能够帮你解决angular – MatDialog无法正确显示所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。