met*_*lah 5 javascript angularjs ionic-framework
我目前正在使用ionic-timepicker插件为我的 Ionic 应用程序创建一个时间选择器。
不幸的是,我在将当前时间设置为默认时间并在用户进行选择时更新值时遇到问题。
我怎样才能弄清楚出了什么问题?
控制器.js
$scope.appointmentTime = ((new Date()).getHours() * 60 * 60);
$scope.timePickerObject = {
inputEpochTime: ((new Date()).getHours() * 60 * 60), //Optional
step: 15, //Optional
format: 12, //Optional
titleLabel: '12-hour Format', //Optional
setLabel: 'Set', //Optional
closeLabel: 'Close', //Optional
setButtonType: 'button-positive', //Optional
closeButtonType: 'button-stable', //Optional
callback: function(val) { //Mandatory
timePickerCallback(val);
}
};
function timePickerCallback(val) {
if (val) {
$scope.timePickerObject.inputEpochTime = val;
}
}
Run Code Online (Sandbox Code Playgroud)
书.html
<ionic-timepicker input-obj="timePickerObject">
<button class="button button-block button-positive overflowShow" style="margin-top: 0px; margin-bottom: 0px">
<standard-time-meridian etime='timePickerObject.appointmentTime'></standard-time-meridian>
</button>
</ionic-timepicker>
Run Code Online (Sandbox Code Playgroud)
您的代码中是否包含“standardTimeMeridian”指令?
然后是属性etime必须绑定到“timePickerObject.inputEpochTime”而不是未定义的 timePickerObject.appointmentTime。
这是一个工作示例:
http://codepen.io/beaver71/pen/VegagQ
| 归档时间: |
|
| 查看次数: |
293 次 |
| 最近记录: |