Skip to content

Instantly share code, notes, and snippets.

@pycraft114
Created January 12, 2018 05:39
Show Gist options
  • Save pycraft114/2587498afcfce609b6179fda70f4ae7c to your computer and use it in GitHub Desktop.
Save pycraft114/2587498afcfce609b6179fda70f4ae7c to your computer and use it in GitHub Desktop.
@Component()
class ContactsApp implements OnInit{
firstName: string = 'Super';
lastName: string = 'Cat';
constructor(private http: Http) {}
ngOnInit() {
this.http.get('/name/mouse')
.map(res => res.json())
.subscribe(({mouseFullName}) => {
this.firstName = mouseFullName.firstName;
this.lastName = mouseFullName.lastName;
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment