Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/394.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 将当前时间设置为默认时间并更新该值_Javascript_Angularjs_Ionic Framework - Fatal编程技术网

Javascript 将当前时间设置为默认时间并更新该值

Javascript 将当前时间设置为默认时间并更新该值,javascript,angularjs,ionic-framework,Javascript,Angularjs,Ionic Framework,我目前正在使用该插件为我的Ionic应用程序创建一个时间选择器 不幸的是,我在将当前时间设置为默认时间以及在用户进行选择时更新该值时遇到问题 我怎样才能找出问题所在 controller.js $scope.appointmentTime = ((new Date()).getHours() * 60 * 60); $scope.timePickerObject = { inputEpochTime: ((new Date()).getHours() * 60 * 60),

我目前正在使用该插件为我的Ionic应用程序创建一个时间选择器

不幸的是,我在将当前时间设置为默认时间以及在用户进行选择时更新该值时遇到问题

我怎样才能找出问题所在

controller.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;
    }
  }
book.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>

您的代码指令中包含了吗

然后属性
etime
必须绑定到'timePickerObject.inputEpochTime'而不是未定义的timePickerObject.AppointTime

以下是一个工作示例: