Thursday 2 February 2017

NG2- Model Popup close using Angular 2 component functionality

Model Popup close using Angular 2 functionality:
===========================================


soln: 1 jQuery based
=======
 jQuery variable with any type inside Angular2 controller.

public jQuery:any;

Add the above just after import statements and before component decorator.

Then access bootstrap modal with it's id like this.

jQuery("#myModal).modal("hide");



Soln:2: Typescript based
=======
<div id="myModal" [hidden]="hideModal" class="modal fade">

hideModal: boolean = false;

 set submitComments(), set hideModal to true
 submitComments(){

 this.hideModal = true;
 }

Ref: http://stackoverflow.com/questions/35354041/how-can-i-close-a-modal-in-angular-2

No comments:

Post a Comment