ng-selected表达式在true时不选择

时间:2017-02-15 01:01:27

标签: angularjs ionic-framework ionic2

0的索引为attribute时,请将选定的<select formControlName="type" required> <option value="{{ accommodation.id }}" *ngFor="let accommodation of ListAccommodationTypes; let i = index;" ng-selected="0 in i">{{ accommodation.name }}</option> </select> 添加到该选项中。我不确定我做错了什么。

以下是我正在使用的代码

<select formcontrolname="type" required="" ng-reflect-name="type" class="ng-untouched ng-pristine ng-invalid">
   <!--template bindings={
      "ng-reflect-ng-for-of": "[object Object],[object Object],[object Object],[object Object],[object Object]"
      }-->
   <option ng-selected="0 in i" value="4" ng-reflect-value="4">Something 4</option>
   <option ng-selected="0 in i" value="5" ng-reflect-value="5">Something 5</option>
   <option ng-selected="0 in i" value="3" ng-reflect-value="3">Something 3</option>
   <option ng-selected="0 in i" value="2" ng-reflect-value="2">Something 2</option>
   <option ng-selected="0 in i" value="1" ng-reflect-value="1">Something 1</option>
</select>

这是它在DOM中呈现的内容

<select formControlName="type" required>
   <option value="{{ accommodation.id }}" *ngFor="let accommodation of ListAccommodationTypes; let i = index;" ng-selected="i==0">{{ accommodation.name }}</option>
</select>

<select formControlName="type" required>
   <option value="{{ accommodation.id }}" *ngFor="let accommodation of ListAccommodationTypes; let i = index;" ng-selected="{{i==0}}">{{ accommodation.name }}</option>
</select>

我也试过

with_items

1 个答案:

答案 0 :(得分:1)

试试这个

__init__.py