2014-12-03 78 views
2

爲什麼input [number]標籤上的min/max屬性在更改時未更新?AngularJS - 輸入[數字]最小/最大綁定

JS:

angular.module('test', []) 
    .controller('mainctrl', function ($scope, $timeout) { 
    $scope.min = 10; 
    $scope.value = 20; 

    $timeout(function() { 
     $scope.min = 30; 
    }, 3000); 
}); 

HTML:

<input name="min" class="form-control" type="number" ng-model="min"> 
<input name="value" class="form-control" type="number" ng-model="value" min="{{min}}"> 

JSBin:http://jsbin.com/devilehize/1/edit?html,js,output

什麼,我期待的是,超時被觸發後的 「值」 字段無效。 但它仍然有效,儘管最小值現在高於該字段中的當前值。

Angular版本1.2.26。由於關於此主題的最後一篇文章是從2013年12月開始的,我不認爲這是重複的,因爲這顯然是一個已知問題,可能已經修復。

編輯:

角度1.3.2版本的,這是問題似乎是固定的。但是因爲我在1.2.26上運行了一個生產應用程序,所以這個問題仍然是一個答案/解決方法。 JSBin:http://jsbin.com/miyuqunoze/1/edit?html,js,output

+1

最好在這裏放一些代碼以便快速閱讀。只是好的形式。 – rfornal 2014-12-03 13:25:28

+0

Got ya @rfornal – strangfeld 2014-12-03 13:31:40

+0

1.3.0按預期工作 – havenchyk 2014-12-03 14:00:37

回答

0

它實際上是本應被固定在V1.3(03bb888)由九月底在角度中的錯誤(#2404)。

相關問題