0
<form novalidate class="simple-form">
    <label ng-hide="tab==1">Reviews Min: <input type="number" ng-init="revNum=30" class="form-control review-input" min="0" step="10" ng-model="revNum" /></label>
    <label>Min Price &#163;: <input type="number" ng-init="minNum=0" class="form-control price-input" min="0" step="1000" ng-model="minNum" /></label>
    <label>Max Price &#163;: <input type="number" ng-init="maxNum=0" class="form-control price-input" min="0" step="1000" ng-model="maxNum" /></label>
    <label><select ng-model="currentCarType"  style="display:block;" ng-options="key for key in carTypeObj">
        <option value="">Select Type</option>
    </select></label>
    <label><button class="btn btn-primary " style="display:block;" ng-click="updateNumArray(revNum, minNum, maxNum); updateType(currentCarType)">Filter</button></label>
    <label><button class="btn btn-primary " style="display:block;" ng-click="resetNumArray(); resetType()">reset</button></label>
</form>

Here is my controller:

carApp.controller("TableBodyCtrl", function($scope, $http){
    $scope.revNum = 30;
    $scope.minNum = 0;
    $scope.maxNum = 0;
    $scope.currentCarType = null;

    $scope.resetType = function(){
        $scope.currentCarType = null;
    }

    $scope.resetNumArray = function(){
        $scope.revNum = 30;
        $scope.minNum = 0;
        $scope.maxNum = 0;
    }

When I click reset button my table updates and so currentCarType is null, revNum is 30, minNum is 0 and maxNum is 0. But my input fields as well as my select are not update. How can I fix that?

Michael
  • 15,386
  • 36
  • 94
  • 143

1 Answers1

2

I guess you probably are falling for the problem discussed here: Why don't the AngularJS docs use a dot in the model directive?

The input's model is initialized on a parent scope, but as soon as you edit in there the value is stored in a child scope and subsequently also read from there.

Community
  • 1
  • 1
eekboom
  • 5,551
  • 1
  • 30
  • 39