【发布时间】:2020-09-02 13:50:24
【问题描述】:
我正在使用 angular 7 bootstrap 4。我需要在模型弹出时显示会话超时。
我在运行时写的一切都没有错误吗?
我的 app-component.html
<router-outlet></router-outlet>
<div bsModal #childModal="bs-modal" class="modal fade" tabindex="-1"
role="dialog" aria-labelledby="dialog-child-name">
<div class="modal-dialog modal-md">
<div class="modal-content">
<div class="modal-header">
<h4 id="dialog-child-name" class="modal-title pull-left">You Have Been Idle!</h4>
<button type="button" class="close pull-right" aria-label="Close" (click)="hideChildModal()">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
{{idleState}}
<div class="row mrgbtm">
<div class="col-md-6">
<button type="button" (click)="logout()" class="btn btn-danger">Logout</button>
</div>
<div class="col-md-6">
<button type="button" (click)="stay()" class="btn btn-success">Stay</button>
</div>
</div>
</div>
</div>
</div>
</div>
**而我的 app-component.ts 是 **
import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core';
import { Subscription } from 'rxjs';
import { Router, NavigationEnd } from '@angular/router';
import { filter } from 'rxjs/operators';
import { Idle, DEFAULT_INTERRUPTSOURCES } from '@ng-idle/core';
import { Keepalive } from '@ng-idle/keepalive';
import { BsModalService } from 'ngx-bootstrap/modal';
import { BsModalRef } from 'ngx-bootstrap/modal';
import { ModalDirective } from 'ngx-bootstrap/modal';
import { AppService } from './shared/services/AppService';
@Component({
selector: 'app-root',
templateUrl: './app.component.html'
})
export class AppComponent implements OnInit, OnDestroy {
@ViewChild('childModal', { static: false }) childModal: ModalDirective;
........
.......
}
请您向我提出解决方案
【问题讨论】:
标签: session bootstrap-4 model angular7 popupwindow