2017年9月8日 星期五

ng-if 使用注意事項

如果同時使用 ng-model,因為 ng-if是自己的 scope,所以需要用物件綁定才能正常運作,否則切換 ng-if 的值會重新產生scope,ng-model value 會回到預設值
ng-model="word.value" ng-if="show"

或者可以直接綁定parent 避免此問題
ng-model="$parent.wordvalue" ng-if="show"

沒有留言:

自訂權限驗證機制

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