如何在bootstrap小部件中设置时间

时间:2018-04-02 16:26:51

标签: javascript angular typescript bootstrap-4

我在我的角度应用程序中使用此Widget。在我的 var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getActiveSheet(); var range = sheet.getRange("A1:F30"); var values = range.getValues(); var sortByCol = function Sort(sort) { var sort = sort.toLowerCase(); for (var i=1; i <= range.getNumColumns(); i++) { if (String(values[0][i]).toLowerCase() === sort) { range.sort({column: i+1, ascending: false}); break; } } }

appmodule.ts

窗口小部件显示在UI中,但未设置时间。enter image description here

  import {NgbModule} from '@ng-bootstrap/ng-bootstrap';
  imports:[NgbModule.forRoot(),....]

在html //inside component.ts meridian = true; timePickerFormat:any ; //inside constructor this.timePickerFormat = {hour: 13, minute: 30};

2 个答案:

答案 0 :(得分:0)

你可以在component.ts中尝试timePickerFormat而不是this.timePickerFormat吗?

这是工作的plunkr链接http://plnkr.co/edit/waq1Ksq6Cf01eqYFOgwC?p=streamer

import {Component} from '@angular/core';
@Component({
  selector: 'ngbd-timepicker-basic',
  templateUrl: 'src/timepicker-basic.html'
})
export class NgbdTimepickerBasic {
  timePickerFormat = {hour: 13, minute: 30};
  meridian=true
}

答案 1 :(得分:0)

尝试[ngModel]而不是[(ngModel)],我认为这是ng-bootstrap timepicker中的一个问题

<ngb-timepicker [ngModel]="timePickerFormat" [meridian]="meridian"></ngb-timepicker>