繁体   English   中英

我需要关闭angular4中component.ts中的弹出消息

[英]I need to close the popup message in component.ts in angular4

在component.html中,我目前有一个弹出消息,打开和关闭功能在html中,但是我需要一种方法中的关闭功能

   <ng-template #content let-c="close" let-d="dismiss">
         <div class="modal-header">

          <button type="button" class="close" aria-label="Close" 
            (click)="d('Cross click')">
             <span aria-hidden="true">&times;</span>
            </button>

             <h4>Cinema Operator</h4>
                </div>
                <div class="modal-body">
                <li class="nav-item"> Import from your Excel </li>
                 </div>
                   <div class="modal-footer">

             <input type="file" accept=".xlsx" class="btn btn-
                 success"(change)="onFileChange($event)">

                <button type="file" class="btn dark btn-outline" 
                (click)="c('Close click');uploadfile()">Upload</button>
                              </div>
                        </ng-template> 
    ----------------------------------------------------
 <button class="btn btn-default" *ngIf="message" (click)="open(content)">Add New Operator</button>

open(content)将打开弹出消息,c('Close click')将关闭Component.html中的弹出消息,但是我需要在uploadfile()方法中使用此关闭功能,请帮我解决此问题

我认为您所需要做的就是将引用传递给该函数,

模板面:

变更:

(click)="c('Close click');uploadfile()"

(click)="uploadfile(c)"

组件侧:

uploadfile(c){
    ... // your code
    c('Close click');
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM