私は以下のフィールド - 国、州、市、中心を持っています。anglejsでデフォルト値が選択されている場合、フィールドにデフォルト値を設定し、他のフィールドを無効にする方法
すべてのフィールドのデフォルト値は "すべて"です。
前のフィールド値の選択を使用してフィールドを1つずつ有効にできます。
しかし、値として「すべて」は考慮されていません。それが考慮されている場合、状態はアクティブになっています。誰もがすべてのフィールドに "すべて"として既定値を設定する方法を教えてください、 "すべて"が選択されている場合、他のフィールドは値として "すべて"を考慮して無効にする必要があります。
マイHTMLページ:
<div class="col-sm-2 sidenav" style="height:850px;">
<div class="well">
<form class="form-row " role="form">
<div class="form-group">
<label class="control-label col-sm-14" for="fName">Country*</label>
<select class="form-control" ng-model="model.selectedCountry" name="country" ng-change="GetCountry(model.selectedCountry)">
<!--<option value class selected>ALL</option>-->
<option ng-repeat="item in model.countries track by $index" value="{{item}}">{{item}}</option>
</select>
</div>
<div class="form-group">
<label class="control-label col-sm-20" for="fName">State*</label>
<select class="form-control" ng-model="model.selectedState" name="state" ng-change="GetState(model.selectedState)" ng-disabled="!model.selectedCountry">
<!--<option value class selected>ALL</option>-->
<option ng-repeat="item in model.states track by $index" value="{{item}}">{{item}}</option>
</select>
</div>
<div class="form-group">
<label class="control-label col-sm-20" for="fName">City*</label>
<select class="form-control" ng-model="model.selectedCity" name="city" ng-change="GetCity(model.selectedCity)" ng-disabled="!model.selectedState">
<!--<option value class selected>ALL</option>-->
<option ng-repeat="item in model.cities track by $index" value="{{item}}">{{item}}</option>
</select>
</div>
<div class="form-group">
<label class="control-label col-sm-20" for="fName">Center*</label>
<select class="form-control" ng-model="model.selectedCenter" name="center" ng-change="GetCenter(model.selectedCenter)" ng-disabled="!model.selectedCity">
<!--<option value class selected>ALL</option>-->
<option ng-repeat="item in model.centers track by $index" value="{{item}}">{{item}}</option>
</select>
</div>
<div class="form-group">
<label class="control-label col-sm-20" for="fName">Role*</label>
<select class="form-control" ng-model="model.selectedRole" name="city" ng-change="GetRole(model.selectedRole)" ng-disabled="!model.selectedCountry">
<!--<option value class selected>ALL</option>-->
<option ng-repeat="item in model.roles track by $index" value="{{item}}">{{item}}</option>
</select>
</div>
<div class="form-group">
<button type="submit" href="#" ng-click="HeadCount()" class="btn btn-primary btn-lg" ng-hide="submitButton" ng-disabled="!model.selectedRole">SUBMIT</button>
</div>
</form>
</div>
</div>
...あなたのコントローラであなたの初期化部分に次の行を追加する必要があり、「すべて」はまた、あなたのドロップダウンリストの右にある値はありますか?次に、ng-disabled = "!model.selectedCountry"はfalseを返します。次のドロップダウンが有効になります。ではない? – Guna
ng-disabledにもう1つのブール変数を使用します。 'ng-change'で呼び出されたメソッドの条件に基づいて、その変数に 'true'または 'false'の値を与える – Guna
もう1つのブール値ng-disable?詳細を説明してください。 –