Answer the question
In order to leave comments, you need to log in
Angular2 how to display modal window?
Hello.
New to Angular and JS in general.
So. there is Clarity UI.
The button on the supporter by which the method is called in the component of this page:
changeQty(restQty: number, uidItem: string)
{
this.itemQtyUpdateService.updateItemQty(uidItem, restQty)
.subscribe(
(item: Item[]) => {
this.item = item;
// тут вызываем модальное окно
import { Directive } from '@angular/core';
import { ElementRef } from '@angular/core/';
import { OnInit } from '@angular/core/';
@Directive({
selector: '[appModal]'
})
export class ModalDirective implements OnInit {
constructor(private element: ElementRef) { }
ngOnInit(): void {
console.log(this.element);
this.element.nativeElement.clrModalOpen = 'opened';
}
showModal() {
this.element.nativeElement.clrModalOpen = 'true';
console.log(this.element);
}
}
<clr-modal appModal [(clrModalOpen)]="opend" [clrModalClosable]="false">
<h3 class="modal-title">No "x" in the top-right corner</h3>
<div class="modal-body">
<p> Для </p>
<p> По заказу </p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" (click)="opened = false">
Я все правильно положил!
</button>
</div>
</clr-modal>
Answer the question
In order to leave comments, you need to log in
no need to suffer, make dialogs separate components and call them through the service in the code https://valor-software.com/ngx-bootstrap/#/modals. And your dialogues will be available anytime and anywhere. Not where it says at the bottom of the page.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question