반응형

아이오닉2

    ionic back button 제거

    ion-navbar 태그에서 hideBackButton 옵션만 기재해주면 된다.

    ionic2 현재 플랫폼 확인 방법

    // platform 확인을 위한 모듈 추가 import { Platform } from 'ionic-angular'; // app.component.ts 파일에서 플랫폼 확인 12345678910111213141516171819202122@Component({ templateUrl: 'app.html' }) export class MyApp { rootPage = HomePage; constructor(platform: Platform) { platform.ready().then(() => { if (this.platform.is('android')) { console.log("running on Android device!"); } if (this.platform.is('ios')) { console..

    뒤로가기 버튼 차단

    앱의 비밀번호 입력 페이지등을 만들다 보면 뒤로가기 버튼을 막아야 하는 경우가 있다. 이 경우 platform에서 제공하는 뒤로가기 버튼 Action을 재정의하여 차단한다. 123456789101112131415161718192021222324252627282930313233343536373839404142434445 // Property used to store the callback of the event handler to unsubscribe to it when leaving this page public unregisterBackButtonAction: any; constructor(...) { ... } ionViewDidEnter() { this.initializeBackButtonCusto..

    백그라운드 상태에서 활성화 되었을때 동작 수행

    앱을 사용하다가 다른 앱을 사용하다가 다시 사용하려고 할때 이벤트를 잡으려고 할경우엔 app.component.ts 파일에 12345678910constructor( private platform: Platform ) {platform.ready().then(() => { this.platform.pause.subscribe(() => { console.log('[INFO] App paused'); }); this.platform.resume.subscribe(() => { console.log('[INFO] App resumed'); });});Colored by Color Scriptercs resume.subscribe를 구현하여 그안에 다시 활성화 되었을때 실행할 코드를 기입한다

    UI 요소 동적으로 disabled 처리

    ts 파일에 기준이 되는 변수 선언 isenabled:boolean=false; ts 파일에서 상황에 따라 변수 값을 변경 changeAble() { if(input !== '') { //enable the button isenabled=true; } else { //disable the button isenabled=false; } } Html표시 ts에 변수의 값이 변경됨에 따라 view에서 button의 활성화 여부가 결정된다.

반응형