«   2026/03   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31
Archives
Today
Total
관리 메뉴

wedul

UI 요소 동적으로 disabled 처리 본문

하이브리드/아이오닉

UI 요소 동적으로 disabled 처리

wedul 2018. 5. 27. 21:56
반응형

ts 파일에 기준이 되는 변수 선언
isenabled:boolean=false;

ts 파일에서 상황에 따라 변수 값을 변경
changeAble() {
  if(input !== '')
  { 
     //enable the button isenabled=true; 
   else { 
      //disable the button isenabled=false; 
   }
}

Html표시
<button ion-button [disabled]="!isenabled"></button>

ts에 변수의 값이 변경됨에 따라 view에서 button의 활성화 여부가 결정된다.

반응형