我正在使用[disabled]="true"
禁用日期选择器,
app.component.html :
<div>
<angular2-date-picker [(ngModel)]="date" [settings]="settings" [disabled]="true"></angular2-date-picker>
</div
app.component.ts :
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
date: Date = new Date();
settings = {
bigBanner: false,
timePicker: false,
format: 'dd-MM-yyyy',
defaultOpen: false,
disabled: true
}
}
答案 0 :(得分:2)
尝试指针事件
在什么情况下(如果有)设置指针事件CSS属性 特定的图形元素可以成为鼠标事件的目标
<angular2-date-picker [(ngModel)]="date" [settings]="settings"
[ngStyle]="{'pointer-events': true ? 'none' : 'auto' }" >
</angular2-date-picker>