Created
January 12, 2018 05:39
-
-
Save pycraft114/2587498afcfce609b6179fda70f4ae7c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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