javascript - 无法正确显示 Angular 对话框
问题描述
我正在尝试在 Angular 中创建一个对话框,但该对话框未显示在中心,仅显示为左侧的垂直白色矩形。我将包含一张描述确切问题的图像:页面截图。
- 我在我的
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
在entrycomponents
数组中添加module
.
像这样。
entryComponents: [LoginComponent]
推荐阅读
- r - 多个日期之间的日期向量
- java - 有没有办法使用 Spring 注入 Tomcat 服务器配置?
- server - 自动化发布 tableau 仪表板的过程
- kubernetes-helm - Helm Chart - 合并具有不同结构的两个值
- node.js - 使用 Cloudbuild 部署到 App Engine 失败
- r - 按组过滤小标题
- c - 如何比较 2 个单链表是否包含相同的数据(无论顺序如何)?
- flutter - 如何使用 HIVE、Flutter 为两个不同的 Modal 类注册两个适配器?
- sql - 选择指定时间段内每个日期的最后记录值
- makefile - Make:是否可以从模式匹配中构建依赖关系?