2016年8月24日 星期三

客製化 ng-options

改用 ng-repeat
例如依據顯示文字設定class

<style>
option[data-text*="未完成"] {
  color: red;
}
</style>
<select ng-model="countrySelected">
  <option ng-repeat="country in countries" value="{{country.CountryCode}}"         
          data-text="{{country.CurrencyName}}">{{country.CurrencyName}}</option>
</select>

1 則留言:

匿名 提到...

若要指定選項的預設值,不能靠 select 的 ng-model,而必須在 option 加入屬性:
ng-selected="{{country.CountryCode == countrySelected}}"

自訂權限驗證機制

// 使用 filter [Route("api/[controller]")] [ApiController] [Authorize] [TypeFilter(typeof(CustomAsyncAuthorizationFilter))] public c...