我有一個輸入文本字段爲反映:AngularJS文本輸入值在範圍上並不可變
<input type="text" class="form-control" id="inputValue" name="uservalue" ng-model="inputNumber" ng-required="true" autofocus="true" ng-blur="checkIfValid()"/>
我的控制器具有納克模糊功能如下:
$scope.checkIfValid = function(){
console.log("Value is = " + $scope.inputNumber);
}
我已經定義 - $scope.inputNumber = '';
即使我在文本字段中輸入一個值並點擊'Tab'或移動到下一個字段來調用ng-blur函數,我的console.log顯示一個空值。
我在這裏做錯了什麼? `
可能plunker? – mfrachet
爲了調試目的,請嘗試使用ng-change代替ng-blur。對於詳細描述問題的重擊者也是+1。 – Sombriks
同意一個重拳 - 控制器/指令如何綁定在一起? –