Skip to content

Instantly share code, notes, and snippets.

@gparlakov
Created March 10, 2019 13:58
Show Gist options
  • Select an option

  • Save gparlakov/0bad4749bd707670ca93166b73e255fa to your computer and use it in GitHub Desktop.

Select an option

Save gparlakov/0bad4749bd707670ca93166b73e255fa to your computer and use it in GitHub Desktop.
import { Component, ViewEncapsulation } from '@angular/core';
@Component({
selector: "gp-button2",
template: `
<button class="button" (click)="onToggleDialogClick()">
Show dialog
</button>
<p-dialog header="Title" [(visible)]="visible">
This is the dialog content
</p-dialog>
`,
styles: [".button { background-color: cyan;}",
".pi.pi-times {color: red}"], // style the close icon
encapsulation: ViewEncapsulation.None // we need this
})
export class Button2Component {
visible = false;
onToggleDialogClick() {
this.visible = !this.visible;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment