如何解决无法正确显示角度对话框
我试图在Angular中创建一个对话框,但是该对话框未显示在中央,仅显示为左侧的垂直白色矩形。 我将附上一张描述确切问题的图片:screenshot of the page。
- 我在
appmodule.ts
文件中包含了条目组件 - 编译时没有错误。
标题component.ts
文件:
import { Component,OnInit } from '@angular/core';
import { MatDialog,MatDialogRef } from '@angular/material';
import { LoginComponent } from '../login/login.component';
@Component({
selector: 'app-header',templateUrl: './header.component.html',styleUrls: ['./header.component.scss']
})
export class HeaderComponent implements OnInit {
constructor(public dialog: MatDialog ) { }
ngOnInit() {
}
openLoginForm() {
this.dialog.open(LoginComponent,{width: '500px',height: '450px'});
}
}
解决方法
在LoginComponent
的{{1}}数组中添加entrycomponents
。
像这样
module
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。