将数据传递到Sidemenu Ionic

时间:2018-11-10 14:23:15

标签: angular cordova ionic-framework

我用fb登录,并在确认后重定向到主页,但是我想将数据传递到App.html,因为我的sideMenu在其中。但是我找不到将数据传递到app.component.ts的方法 谁能给我一个关于如何获取侧面菜单数据的想法?

1 个答案:

答案 0 :(得分:0)

使用离子的events插件

在您的"client timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while waiting for request, client: 127.0.0.1, server: 0.0.0.0:8080" 文件中,创建一个函数或将代码放在平台下,以监听所有已发布的事件

$route['default_controller'] = 'Users/login';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
$route['registration'] = 'registration';
$route['login'] = 'login';
$route['subit_backend']['GET']='subit_backend/register';
$route['save_userinput']='Users/save_userinput';
使用以下代码成功登录后,在您的app.component.ts文件中

  events.subscribe('user:created', (user, time) => {
    // user and time are the same arguments passed in `events.publish(user, time)`
    console.log('Welcome', user, 'at', time);
  });

有关更多信息,请阅读events插件