AngularJS,如何让`select`自动刷新?

AngularJS, how do you get a `select` to refresh automatically?

我在第一个 'select' 中选择一个选项时遇到 'select' 问题 我在第二个 'select' 中没有同时看到结果,我必须刷新使用 'F5' 手动翻页,以便我可以看到结果。 add_parcelle.html

  <div class="row">
    <div class="col-md-12">
        <div class="form-group" ng-class="{'has-error':Form.type.$dirty && Form.type.$invalid, 'has-success':Form.type.$valid}">
            <label for="form-field-select-2">
                Type de la parcelle <span class="symbol required"></span>
            </label>
            <select name="type" ng-model="type" title="select" class="cs-select cs-skin-elastic" ng-change="sendType(Form.type.$modelValue)" required>
                <option value="" disabled selected>Selectionnez un type</option>
                <option value="Lot">Lot</option>
                <option value="Parcelle">Parcelle</option>
                <option value="Zone">Zone</option>
                <option value="Plant">Plant</option>
            </select>
            <span class="error text-small block" ng-if="Form.type.$dirty && Form.type.$invalid">Champ bligatoire</span>
        </div>
    </div>
</div>

<div class="row">
    <div class="col-md-12">
        <div class="form-group" ng-class="{'has-error':Form.idParcelle.$dirty && Form.idParcelle.$invalid, 'has-success':Form.idParcelle.$valid && Form.idParcelle.$dirty}">
            <label for="form-field-select-2">
                Parent de la parcelle <span class="symbol required"></span>
            </label>
            <select data-ng-init="showParents()" name="idParcelle" ng-model="idParcelle" title="select" class="cs-select cs-skin-elastic">
                <option value="" disabled selected>Selectionnez un parent</option>
                <option value="1">Aucun parent</option>
                <option ng-repeat="p in parcelle" value="{{p.idParcelle}}"><div ng-if="p.parent.libelle">{{p.libelle}}</div></option>
            </select>
            <span class="error text-small block" ng-if="Form.idParcelle.$dirty && Form.idParcelle.$invalid">Champ bligatoire</span>
        </div>
    </div>
</div>

ParcelleController.js

$scope.sendType= function(type){

    $sessionStorage.typeParc=type;
    console.log($sessionStorage.typeParc);

};
$scope.showParents = function() {


    if($sessionStorage.typeParc=='Parcelle')
        $scope.showLots();
    else if($sessionStorage.typeParc=='Zone')
        $scope.showParcels();
        else if($sessionStorage.typeParc=='Plant')
            $scope.showZones();


};

在第一个 'Select' 我使用:

ng-change="sendType(Form.type.$modelValue)"

所以我可以存储 Form.type 并在函数 showParents() 中使用它,它在第二个 'Select'

中显示结果

data-ng-init="showParents()"

所以,这是我的问题!! 提前致谢:)

编辑 'Gustavo Gabriel' 之后 这是结果: enter image description here

我没有在 'select' 中看到该列表,但我在控制台中看到了它 :p

在第一个select修改你的ng-change为:

ng-change="sendType(Form.type.$modelValue); showParents();"

希望对您有所帮助=)