I am using Ng container to show and hide the modal dialog box.I tried your code but its not working for our current scenario.Please read the code carefully and give me an proper solution.
Herewith I attach the html and typescript code fully.Please check it and get back to us soon.
<ng-container *ngIf="ShowEnvIncidentCreation">
<ej-dialog id="Correctiveactiondialog" title="Corrective Action" [enableResize]="resize" [showOnInit]='false' width="150%" [isResponsive]='responsive'
containment='#parent' (close)="onCorrectiveClose($event)" [enableModal]="enablemodal">
<form #corrective="ngForm" ng-submit="addEnvCorrective(corrective)">
<div class="panel-group">
<div class="row mfg-top panel panel-default">
<div class="row mrgn_btm">
<div class="col-lg-12 col-md-12 mfg-top">
<div class="row">
<div class="col-lg-12 col-md-12">
<div class="col-lg-3 col-md-3">
<label class="label_size">Responsible Name<span class="red">*</span></label>
</div>
<div class="col-lg-5 col-md-5">
<input class="form-control" id="txtResponsibleName" type="text" name="responsiblename" #nameResponsibleName="ngModel"
ej-autocomplete [fields]="fields" width="200px" [(ngModel)]="safetycorrectiveevent.responsibleName" [dataSource]="userdetail" watermarkText="Enter Responsible Name"
required autocomplete="off" />
<span *ngIf="nameResponsibleName?.touched && !nameResponsibleName.valid" class="validationmessage" style="color:red">
Responsible Name is Required!
</span>
</div>
</div>
</div>
</div>
</div>
<div class="row mrgn_btm">
<div class="col-lg-12 col-md-12">
<div class="col-lg-3 col-md-3">
<label class="label_size">Preliminary Corrective Action Date<span class="red">*</span></label>
</div>
<div class="col-lg-8 col-md-8">
<div class='input-group date'>
<input type="text" [(ngModel)]="safetycorrectiveevent.correctiveActDate" name="correctiveActDate" id="correctiveActDate" #nameCorrectiveActDate="ngModel" width="200px" watermarkText="Enter datetime" ej-datetimepicker required autocomplete="off">
<span *ngIf="nameCorrectiveActDate?.touched && !nameCorrectiveActDate.valid" class="validationmessage" style="color:red">
Prelimenary Corrective Action Date is Required!
</span>
</div>
</div>
</div>
</div>
<br />
<div class="row mrgn_btm">
<div class="col-lg-12 col-md-12">
<div class="col-lg-3 col-md-3">
<label class="label_size">Corrective Action Closure Date<span class="red">*</span></label>
</div>
<div class="col-lg-8 col-md-8">
<div class='input-group date'>
<input type="text" [(ngModel)]="safetycorrectiveevent.confCorrectiveActCloseDate" name="confCorrectiveActCloseDate" #nameConfCorrectiveActCloseDate="ngModel" width="200px" id="datetimepick" watermarkText="Enter Corrective Action Date" ej-datetimepicker required autocomplete="off">
<span *ngIf="nameConfCorrectiveActCloseDate?.touched && !nameConfCorrectiveActCloseDate.valid" class="validationmessage" style="color:red">
Corrective Action Closure Date is Required !
</span>
</div>
</div>
</div>
</div>
<div class="row mrgn_btm">
<div class="col-lg-12 col-md-12">
<div class="col-lg-3 col-md-3">
<label class="label_size">Prelimenary Action Description<span class="red">*</span></label>
</div>
<div class="col-lg-9 col-md-9" style="margin-left:-5px">
<div class="radio radio-info radio-inline">
<textarea class="form-control" name="correctiveActDesc" #nameCorrectiveActDesc="ngModel" [(ngModel)]="safetycorrectiveevent.correctiveActDesc" watermarkText="Enter Prelimenary Action Description" style="height:90px;width:300px;margin-left:-4%;" watermarkText="Enter Prelimenary Action Description" required autocomplete="off" ></textarea>
<span *ngIf="nameCorrectiveActDesc?.touched && !nameCorrectiveActDesc.valid" class="validationmessage" style="color:red">
Prelimenary Action Description is Required !
</span>
</div>
</div>
</div>
</div>
<div class="row mrgn_btm">
<div class="col-lg-12 col-md-12 mfg-top">
<div class="row">
<div class="col-lg-12 col-md-12" style="text-align:center">
<button class="btn btn-danger btn-space pull-right" style="margin-left:5px;width:100px;" (click)="btnClick($event)">Cancel</button>
<button class="btn btn-success btn-space pull-right" style="width: 100px;margin-left:10px;" (click)="addeventcorrective(safetycorrectiveevent)" [disabled]="corrective.invalid">Add</button>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
</ej-dialog>