Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Mark Jones
seal-mask
PLUS
.a{fill-rule:evenodd;}techdegree seal-36
Mark Jones
Full Stack JavaScript Techdegree Graduate 29,362 Points

Promises in Angular 4

I am using an Angular 4 service to do a firebase auth call and return the user info to the compnent. In the component, I use a promise to save the user data in a variable after it is retrieved. The html template then gets data from that to display user info. It works exactly as expected in Firefox. However, in Chrome it does not. Chrome says that the user info recieved from the auth call is undefined which leads me to think it is an async problem..but why does it work in Firefox and not Chrome? The two functions are

loginWithTwitter():void { this.authService.twitterLogin() .then((result)=> this.afterSignIn(result)); }

afterSignIn(result){ var authUser = result.user; var creds = { userId: authUser.uid, userName: authUser.displayName, photo: authUser.photoURL, }; this.user.push(creds) this.saveUser(creds); }; This seems to be my last stumbling block before submission...Can anyone help out?

Thanks