Prime Modal无法打开

时间:2018-05-14 15:53:53

标签: angular modal-dialog primeng

我在Angular 2中创建了一个主要的NG模态。它应该在单击一个按钮时打开,该按钮调用下面的toggleDeleteModalDisplay方法,但它似乎没有打开。不知道我做错了什么,因为我在代码中有其他模态基本相同

import { Component, ViewEncapsulation, Injectable } from '@angular/core';

@Component({
    selector: 'delete-user',
    templateUrl: './delete-user.component.html',
    encapsulation: ViewEncapsulation.None,
})

export class DeleteUserComponent {

    public deleteModalDisplay : boolean = false;

    public toggleDeleteModalDisplay() : void {
           this.deleteModalDisplay = !this.deleteModalDisplay;
    }

}
<p-dialog [(visible)]="deleteModalDisplay" [width]="500"
          [draggable]="false" [modal]="true" [dismissableMask]="true"
          class="delete-user-modal">
    <p-header class="header-modal">
        Delete User
    </p-header>
</p-dialog>

import { DeleteUserComponent } from './delete-user/delete-user.component';


@Component({
    templateUrl: './manage-users.component.html',
    styleUrls: ['./manage-users.component.less'],
})
export class ManageUsersComponent {
    constructor(public deleteUserComponent: DeleteUserComponent) {}

    public deleteUser() : void {
      this.deleteUserComponent.toggleDeleteModalDisplay();
    }
 }

0 个答案:

没有答案