을 사용하고
; 나는 사용자가 로그인 한 후 서버에서 사이드 메뉴 옵션을 얻기 위해 서비스를 만들었다.
높은 단계;
로그인 :
import { Events } from 'ionic-angular';
constructor:
public events: Events
//after user login publish the event
this.events.publish('userlogin');
app.components.ts:
import { Events } from 'ionic-angular';
constructor:
public events: Events;
//subscribe the previous event in constructor and add below in constructor
this.events.subscribe('userlogin',(() => {console.log('Got Events');
this.getDynamicMenuOptions(); // this method gets dynamic side menu options from server }));
당신은 당신이 지금까지 시도 어떤 코드를 게시 할 수 있습니까? – AlexWoe89
메뉴는 모든 사용자에게 공통적이지만 일부 사용자 만 메뉴를 볼 수 있습니까? 당신은 사이드 메뉴에 모든 것을 가지고있을 수 있고 로그인 한 사용자에 기초하여 숨기거나 보여줄 수 있습니다. –
@StevenScott yrs, 그들은 당신이 말한 것처럼 공통적입니다. 나는 그것에 대해 생각하지 않았습니다. 당신에게 감사합니다. –