惊人的时间选择器不会随时间返回AM和PM

时间:2018-12-10 20:25:23

标签: angular timepicker

这是我在组件中调用它的方法

 open() {
const amazingTimePicker = this.atp.open({
  theme: 'material-orange',
  time:this.Start
});
amazingTimePicker.afterClose().subscribe(time => {
    this.Start = time;
    this.onchange()
});
}

这是我的html文件标签,即时通讯在其中使用

  <input disabled   theme="material-orange" type="time" matInput class="material" atp-time-picker value="{{Start}}"/>

1 个答案:

答案 0 :(得分:1)

您需要删除atp-time-picker指令,并以编程方式打开对话框。还要确保您的输入类型是文本,而不是时间。然后尝试:

open() {
  const amazingTimePicker = this.atp.open({
    theme: 'material-orange',
    time:this.Start
  });
  amazingTimePicker.afterClose().subscribe(time => {
    this.Start = time + ( time > 12 ? 'am' : 'pm); // enhance logic
  });
}

和模板:

<input type="text" (click)="open()" value="20:55" value="{{Start}}" />