允许用户一次只选择一个有效值angularjs

时间:2019-02-14 06:26:26

标签: angularjs

 <div ng-repeat="user in profiles track by $index" class="span-width clearfix">
<div class="col-sm-5 col-ie-5">
              <div class="select-input">
               <select
                    name="withDic_{{user.user_id}}"
                    ng-model="user.apply_this"
                    ng-change="save(user, true)"
                    required>
                    <option value="" ng-if="user.apply_this == null" selected="selected">-- Select --</option>
                    <option value="1">Yes</option>
                    <option value="0">No</option>
                  </select>
                </div>
                </div>

function MainCtrl ($scope) {
    $scope.profiles = [
{user_id: 11, first_name: 'Same', last_name : 'Billings', type: 2},
{user_id: 12, first_name: 'Ricky', last_name : 'Ducson', type: 2},
{user_id: 13, first_name: 'Dwayne', last_name : 'Williams', type: 2},
];

}

应该没有机会再选择一个 如果还有更多,则应再选择“是”或“否” 因此一次只能是一个

这里是小提琴 http://jsfiddle.net/xvamuh5d/2/

For an example if i select yes and select chicago i could able to select yes to other. Lets say i selected yes for all three when i choose item rest should be no or select value

0 个答案:

没有答案