pass data to sidemenu Ionic









up vote
0
down vote

favorite












I have a login with fb, and upon confirming, redirects to the main page, however I would like to pass the data to the App.html, because my sideMenu is in it. But I can not find way to pass data to app.component.ts
Can anyone give me an idea of ​​how I get data for the side menu?










share|improve this question























  • You need to have a shared provider (service) that app, any page or component can import/inject and access n xchange data. See angular.io docs for component interaction using shared service
    – Sergey Rudenko
    Nov 10 at 20:11










  • See in this issue: stackoverflow.com/q/53200559/4005366
    – Sergey Rudenko
    Nov 10 at 20:12














up vote
0
down vote

favorite












I have a login with fb, and upon confirming, redirects to the main page, however I would like to pass the data to the App.html, because my sideMenu is in it. But I can not find way to pass data to app.component.ts
Can anyone give me an idea of ​​how I get data for the side menu?










share|improve this question























  • You need to have a shared provider (service) that app, any page or component can import/inject and access n xchange data. See angular.io docs for component interaction using shared service
    – Sergey Rudenko
    Nov 10 at 20:11










  • See in this issue: stackoverflow.com/q/53200559/4005366
    – Sergey Rudenko
    Nov 10 at 20:12












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I have a login with fb, and upon confirming, redirects to the main page, however I would like to pass the data to the App.html, because my sideMenu is in it. But I can not find way to pass data to app.component.ts
Can anyone give me an idea of ​​how I get data for the side menu?










share|improve this question















I have a login with fb, and upon confirming, redirects to the main page, however I would like to pass the data to the App.html, because my sideMenu is in it. But I can not find way to pass data to app.component.ts
Can anyone give me an idea of ​​how I get data for the side menu?







angular cordova ionic-framework






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 10 at 18:23









georgeawg

31.9k104864




31.9k104864










asked Nov 10 at 14:23









Felipe XST

55




55











  • You need to have a shared provider (service) that app, any page or component can import/inject and access n xchange data. See angular.io docs for component interaction using shared service
    – Sergey Rudenko
    Nov 10 at 20:11










  • See in this issue: stackoverflow.com/q/53200559/4005366
    – Sergey Rudenko
    Nov 10 at 20:12
















  • You need to have a shared provider (service) that app, any page or component can import/inject and access n xchange data. See angular.io docs for component interaction using shared service
    – Sergey Rudenko
    Nov 10 at 20:11










  • See in this issue: stackoverflow.com/q/53200559/4005366
    – Sergey Rudenko
    Nov 10 at 20:12















You need to have a shared provider (service) that app, any page or component can import/inject and access n xchange data. See angular.io docs for component interaction using shared service
– Sergey Rudenko
Nov 10 at 20:11




You need to have a shared provider (service) that app, any page or component can import/inject and access n xchange data. See angular.io docs for component interaction using shared service
– Sergey Rudenko
Nov 10 at 20:11












See in this issue: stackoverflow.com/q/53200559/4005366
– Sergey Rudenko
Nov 10 at 20:12




See in this issue: stackoverflow.com/q/53200559/4005366
– Sergey Rudenko
Nov 10 at 20:12












1 Answer
1






active

oldest

votes

















up vote
0
down vote



accepted










Use the events plugin by ionic



in your app.component.ts file either create a function or put the code below inside the platform ready to listen for any published events



 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);
);


in your login.ts file after successfully login publish data using the code below



this.events.publish('user:created', user, Date.now());


for more info please read the events plugin






share|improve this answer




















  • Thanks for replying, I believe I have succeeded, but I do not know how to receive the username in the html. but in console.log I was able to see the data being passed.
    – Felipe XST
    Nov 10 at 16:09










  • can you show me snippet of your code?
    – nyx97
    Nov 12 at 0:48










  • app.component.ts: this.createUser(events); createUser(events) 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); console.log(user); ); in my console I see that I received the value of User
    – Felipe XST
    Nov 12 at 1:00










  • so you declare global variable in your app.component.ts variable:any; events.subscribe('user:created',(user,time)=> this.variable = user; ); then you can get the user in html by using variable
    – nyx97
    Nov 12 at 1:09











  • Thanks, I get almost everything, but in html when I insert user it returns in html [Object, Object]
    – Felipe XST
    Nov 12 at 11:39










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53239885%2fpass-data-to-sidemenu-ionic%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote



accepted










Use the events plugin by ionic



in your app.component.ts file either create a function or put the code below inside the platform ready to listen for any published events



 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);
);


in your login.ts file after successfully login publish data using the code below



this.events.publish('user:created', user, Date.now());


for more info please read the events plugin






share|improve this answer




















  • Thanks for replying, I believe I have succeeded, but I do not know how to receive the username in the html. but in console.log I was able to see the data being passed.
    – Felipe XST
    Nov 10 at 16:09










  • can you show me snippet of your code?
    – nyx97
    Nov 12 at 0:48










  • app.component.ts: this.createUser(events); createUser(events) 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); console.log(user); ); in my console I see that I received the value of User
    – Felipe XST
    Nov 12 at 1:00










  • so you declare global variable in your app.component.ts variable:any; events.subscribe('user:created',(user,time)=> this.variable = user; ); then you can get the user in html by using variable
    – nyx97
    Nov 12 at 1:09











  • Thanks, I get almost everything, but in html when I insert user it returns in html [Object, Object]
    – Felipe XST
    Nov 12 at 11:39














up vote
0
down vote



accepted










Use the events plugin by ionic



in your app.component.ts file either create a function or put the code below inside the platform ready to listen for any published events



 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);
);


in your login.ts file after successfully login publish data using the code below



this.events.publish('user:created', user, Date.now());


for more info please read the events plugin






share|improve this answer




















  • Thanks for replying, I believe I have succeeded, but I do not know how to receive the username in the html. but in console.log I was able to see the data being passed.
    – Felipe XST
    Nov 10 at 16:09










  • can you show me snippet of your code?
    – nyx97
    Nov 12 at 0:48










  • app.component.ts: this.createUser(events); createUser(events) 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); console.log(user); ); in my console I see that I received the value of User
    – Felipe XST
    Nov 12 at 1:00










  • so you declare global variable in your app.component.ts variable:any; events.subscribe('user:created',(user,time)=> this.variable = user; ); then you can get the user in html by using variable
    – nyx97
    Nov 12 at 1:09











  • Thanks, I get almost everything, but in html when I insert user it returns in html [Object, Object]
    – Felipe XST
    Nov 12 at 11:39












up vote
0
down vote



accepted







up vote
0
down vote



accepted






Use the events plugin by ionic



in your app.component.ts file either create a function or put the code below inside the platform ready to listen for any published events



 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);
);


in your login.ts file after successfully login publish data using the code below



this.events.publish('user:created', user, Date.now());


for more info please read the events plugin






share|improve this answer












Use the events plugin by ionic



in your app.component.ts file either create a function or put the code below inside the platform ready to listen for any published events



 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);
);


in your login.ts file after successfully login publish data using the code below



this.events.publish('user:created', user, Date.now());


for more info please read the events plugin







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 10 at 15:00









nyx97

1118




1118











  • Thanks for replying, I believe I have succeeded, but I do not know how to receive the username in the html. but in console.log I was able to see the data being passed.
    – Felipe XST
    Nov 10 at 16:09










  • can you show me snippet of your code?
    – nyx97
    Nov 12 at 0:48










  • app.component.ts: this.createUser(events); createUser(events) 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); console.log(user); ); in my console I see that I received the value of User
    – Felipe XST
    Nov 12 at 1:00










  • so you declare global variable in your app.component.ts variable:any; events.subscribe('user:created',(user,time)=> this.variable = user; ); then you can get the user in html by using variable
    – nyx97
    Nov 12 at 1:09











  • Thanks, I get almost everything, but in html when I insert user it returns in html [Object, Object]
    – Felipe XST
    Nov 12 at 11:39
















  • Thanks for replying, I believe I have succeeded, but I do not know how to receive the username in the html. but in console.log I was able to see the data being passed.
    – Felipe XST
    Nov 10 at 16:09










  • can you show me snippet of your code?
    – nyx97
    Nov 12 at 0:48










  • app.component.ts: this.createUser(events); createUser(events) 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); console.log(user); ); in my console I see that I received the value of User
    – Felipe XST
    Nov 12 at 1:00










  • so you declare global variable in your app.component.ts variable:any; events.subscribe('user:created',(user,time)=> this.variable = user; ); then you can get the user in html by using variable
    – nyx97
    Nov 12 at 1:09











  • Thanks, I get almost everything, but in html when I insert user it returns in html [Object, Object]
    – Felipe XST
    Nov 12 at 11:39















Thanks for replying, I believe I have succeeded, but I do not know how to receive the username in the html. but in console.log I was able to see the data being passed.
– Felipe XST
Nov 10 at 16:09




Thanks for replying, I believe I have succeeded, but I do not know how to receive the username in the html. but in console.log I was able to see the data being passed.
– Felipe XST
Nov 10 at 16:09












can you show me snippet of your code?
– nyx97
Nov 12 at 0:48




can you show me snippet of your code?
– nyx97
Nov 12 at 0:48












app.component.ts: this.createUser(events); createUser(events) 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); console.log(user); ); in my console I see that I received the value of User
– Felipe XST
Nov 12 at 1:00




app.component.ts: this.createUser(events); createUser(events) 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); console.log(user); ); in my console I see that I received the value of User
– Felipe XST
Nov 12 at 1:00












so you declare global variable in your app.component.ts variable:any; events.subscribe('user:created',(user,time)=> this.variable = user; ); then you can get the user in html by using variable
– nyx97
Nov 12 at 1:09





so you declare global variable in your app.component.ts variable:any; events.subscribe('user:created',(user,time)=> this.variable = user; ); then you can get the user in html by using variable
– nyx97
Nov 12 at 1:09













Thanks, I get almost everything, but in html when I insert user it returns in html [Object, Object]
– Felipe XST
Nov 12 at 11:39




Thanks, I get almost everything, but in html when I insert user it returns in html [Object, Object]
– Felipe XST
Nov 12 at 11:39

















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53239885%2fpass-data-to-sidemenu-ionic%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

How to read a connectionString WITH PROVIDER in .NET Core?

In R, how to develop a multiplot heatmap.2 figure showing key labels successfully

Museum of Modern and Contemporary Art of Trento and Rovereto