Skip to content

Instantly share code, notes, and snippets.

@stevermeister
Last active July 2, 2017 21:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevermeister/7173db9deeb922615fc289f25c41dcab to your computer and use it in GitHub Desktop.
Save stevermeister/7173db9deeb922615fc289f25c41dcab to your computer and use it in GitHub Desktop.
import { UserService } from '../user.service';
import { Component } from '@angular/core';
@Component({
selector: 'app-user-card',
template: '<div>{{user?.name}}</div>',
providers: [UserService]
})
export class UserCardComponent {
user;
constructor(private _userService: UserService) { }
someMethod() {
this._userService.getOne(1).subscribe(user => this.user = user);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment