Ionic framework 离子2发布事件第二次不起作用
第一次加载应用程序时,它会工作,但当我注销并再次登录时,订阅方法不会被调用能否显示更多登录和注销功能的代码home.ts中的数据是否会更改?如果没有,则不会再次调用subscribe,因为没有更改任何数据。要测试它,请执行setTimeout(()=>this.events.publish('user:created','test2'),500);Ionic framework 离子2发布事件第二次不起作用,ionic-framework,publish-subscribe,ionic-events,Ionic Framework,Publish Subscribe,Ionic Events,第一次加载应用程序时,它会工作,但当我注销并再次登录时,订阅方法不会被调用能否显示更多登录和注销功能的代码home.ts中的数据是否会更改?如果没有,则不会再次调用subscribe,因为没有更改任何数据。要测试它,请执行setTimeout(()=>this.events.publish('user:created','test2'),500); in app.component.ts this.events.subscribe('user:created', (val) => {
in app.component.ts
this.events.subscribe('user:created', (val) => {
console.log('hello called');
}
and called it from home.ts
this.events.publish('user:created','userDataHome');