Why value doesn't updates on page?

时间:2016-09-01 19:23:24

标签: angularjs cordova cordova-plugins ngcordova

<input name="birthday"
                 type="text"
                 value="{{vm.client.birthday | date:'dd.MM.yyyy'}}"
                 ng-click="vm.selectDate()"
                 readonly
                 required/>

function selectDate() {
      $cordovaDatePicker.show({
        mode: 'date',
        date: new Date(),
        minDate: new Date(1900, 1, 1),
        maxDate: new Date(new Date().getFullYear() - 6, 1, 1)
      }).then(function(date) {
          vm.client.birthday = date;
          $scope.$apply();
      });
    }

Datepicker shows, then callback calls, but value="{{vm.client.birthday | date:'dd.MM.yyyy'}}" doesn't update.

1 个答案:

答案 0 :(得分:2)

在输入标记内使用ng-model / ng-value,而不是值属性。