I just want to show the name of the current logged in user, but I cant make it works.
I wrote this on the app.component
import { Component } from '@angular/core';
import template from './app.component.html';
import {ROUTER_DIRECTIVES} from '@angular/router';
import {LoginButtons} from 'angular2-meteor-accounts-ui';
//import our Carousel Component
import {CSSCarouselComponent} from './imports/componenets/carousel/carousel.component';
import { InjectUser } from 'angular2-meteor-accounts-ui';
@Component({
selector: 'app',
template,
directives: [ROUTER_DIRECTIVES, LoginButtons,CSSCarouselComponent]
})
@InjectUser('user')
export class AppComponent {
user: Meteor.User;
constructor() {
console.log(this.user);
}
loginFacebook(event) {
Meteor.loginWithFacebook({}, function(err){
if (err) {
throw new Meteor.Error("Facebook login failed");
}
console.log(Meteor.user().profile.name;);
});
}
console.log(this.user); underfined
console.log(Meteor.user().profile.name;); works and gives me the name, but I have no success to export it to the html and show that.