Hi, i am in the modal but when i write something in the input into the Modal the function beforeDismiss run and close the modal.
i am use the example:
import { Component } from '@angular/core';
import { DialogRef, ModalComponent, CloseGuard } from 'angular2-modal';
import { BSModalContext } from 'angular2-modal/plugins/bootstrap/index';
export class CustomModalContext extends BSModalContext {
public num1: number;
public num2: number;
}
/**
A Sample of how simple it is to create a new window, with its own injects.
/
@Component({
selector: 'modal-content',
styles: [ .custom-modal-container { padding: 15px; } .custom-modal-header { background-color: #219161; color: #fff; -webkit-box-shadow: 0px 3px 5px 0px rgba(0,0,0,0.75); -moz-box-shadow: 0px 3px 5px 0px rgba(0,0,0,0.75); box-shadow: 0px 3px 5px 0px rgba(0,0,0,0.75); margin-top: -15px; margin-bottom: 40px; } ],
//TODO: [ngClass] here on purpose, no real use, just to show how to workaround ng2 issue #4330.
// Remove when solved.
/ tslint:disable */ template: `
A Custom modal design
Do the math to quit:
I received an injection of the number {{context.num1}} and the number {{context.num2}}
What is the sum?
</div>`
})
export class LoginFacebookComponent implements CloseGuard, ModalComponent {
context: CustomModalContext;
public wrongAnswer: boolean;
public shouldUseMyClass: boolean;
Hi, i am in the modal but when i write something in the input into the Modal the function beforeDismiss run and close the modal. i am use the example:
import { Component } from '@angular/core';
import { DialogRef, ModalComponent, CloseGuard } from 'angular2-modal'; import { BSModalContext } from 'angular2-modal/plugins/bootstrap/index';
export class CustomModalContext extends BSModalContext { public num1: number; public num2: number; }
/**
A Sample of how simple it is to create a new window, with its own injects. / @Component({ selector: 'modal-content', styles: [
.custom-modal-container { padding: 15px; } .custom-modal-header { background-color: #219161; color: #fff; -webkit-box-shadow: 0px 3px 5px 0px rgba(0,0,0,0.75); -moz-box-shadow: 0px 3px 5px 0px rgba(0,0,0,0.75); box-shadow: 0px 3px 5px 0px rgba(0,0,0,0.75); margin-top: -15px; margin-bottom: 40px; }
], //TODO: [ngClass] here on purpose, no real use, just to show how to workaround ng2 issue #4330. // Remove when solved. / tslint:disable */ template: `A Custom modal design
Do the math to quit:
I received an injection of the number {{context.num1}} and the number {{context.num2}}
What is the sum?}) export class LoginFacebookComponent implements CloseGuard, ModalComponent {
context: CustomModalContext;
public wrongAnswer: boolean; public shouldUseMyClass: boolean;
constructor(public dialog: DialogRef) {
this.context = dialog.context;
this.wrongAnswer = true;
dialog.setCloseGuard(this);
}
onKeyUp(value) { this.dialog.close(); }
beforeDismiss(): boolean { console.log("s"); return true; }
beforeClose(): boolean { return this.wrongAnswer; } }
i want that if you click out the modal this close, thank you.
Any Luck @JuanDoctorJekyll ?
onKeyUp(value) { this.dialog.close(); }
^ Here's why