selected =“selected”未填充在<option>标记内的下拉列表中

时间:2016-07-23 11:13:40

标签: html angularjs google-chrome html-select options

我有一个下拉列表,我会将下拉菜单显示为两种类别管理员用户

我需要填充如果下拉列表中包含自动填充在屏幕中的空值。我的问题是它在One(Admin)类别中正常工作,(User)类别无效。下面我粘贴了我在chrome console ELEMENTS标签中获得的代码。

工作

<select ng-model="dept" ng-change="deptCh(dept,buildNameng)" ng-options="option.floor as option.floor for option in dptData 
| unique:'floor'" style="width: 12%;" ng-if="floorNotNull" class="ng-pristine ng-untouched ng-valid ng-scope">

<option value="" class="" selected="selected">---Floor---</option><option value="string:" selected="selected"></option></select>

不工作

<select ng-model="dept" ng-change="deptCh(dept,buildNameng)" ng-options="option.floor as option.floor for option in dptData 
| unique:'floor'" style="width: 12%;" ng-if="floorNotNull" class="ng-pristine ng-valid ng-scope ng-touched">
<option value="" class="" selected="selected">---Floor---</option><option value="string:"></option></select>

我在chrome console中得到了上面的代码。当我记录为 ADMIN 时,工作代码已在选项标记的 END 中选择=“已选择”。

<option value="" class="" selected="selected">---Floor---</option><option value="string:" selected="selected"></option></select>

当我以 USER 身份登录时, END 选项标记内的非工作代码没有选中=“已选中”。

<option value="" class="" selected="selected">---Floor---</option><option value="string:"></option></select>

如果我在无法正常工作selected="selected"标记内的Chrome edit as html中手动添加了option,则其工作正常。

我不知道为什么这个代码工作在一种类型但不工作的另一种类型,如果我以“USER”类型登录,也不会出现selected =“selected”。我将在下面发布我的整个下拉代码

<div ng-show="(staticData == 2) ? trueVar : (firstTimeSubject == 9) ? trueVar : falseVar">
          <label ng-if="floorNull" for="singleSelect">&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp  Floor: </label>
          <select ng-if="floorNull" ng-model="dept" ng-options="option.id as option.floor for option in dptData | unique:'floor'" style="width:12%" ng-change="deptCh(dept,buildNameng)">
            <!-- You can have ONE default, null selection option.-->
            <option value="">---Floor---</option>
          </select>
          <label ng-if="floorNotNull" for="singleSelect">&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp  Floor: </label>
          <select ng-if="floorNotNull" ng-model="dept" ng-options="option.floor as option.floor for option in dptData | unique:'floor'" style="width:12%" ng-change="deptCh(dept,buildNameng)">
            <!-- You can have ONE default, null selection option.-->
            <option value="">---Floor---</option>
</div>

铬合金

在chrome控制台中使用Snap enter image description here

Chrome控制台中的

Not Working snap enter image description here

USER 类别登录中的option代码selected="selected"内无法自动填充上面标记为 RED CIRCLE 代码的无效快照。 selected="selected"自动添加了chrome我在代码中没有添加任何内容。

请指导我,我没有收到任何错误,我测试的是Google Chrome。

1 个答案:

答案 0 :(得分:0)

使用dt.Rows[i][1]指令指定何时应选择项目。

您还可以指定一个返回布尔值的控制器函数,以便您执行更多操作。

相关问题