Created
June 24, 2017 11:38
-
-
Save Armenvardanyan95/664fd87e77b29fa2166680d1cea67e42 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
| interface User { | |
| fullName: string; | |
| age: number; | |
| id: number; | |
| } | |
| @Component({ | |
| selector: 'some-component', | |
| template: `<p-dropDown [options]="users"></p-dropDown>` | |
| }) | |
| class SomeComponent implements OnInit { | |
| users: SelectItem[]; | |
| constructor(private userService: UserService){} | |
| ngOnInit(){ | |
| this.userService.getAllUsers().then((users: User[]) => this.users = users) //service returns a Promise | |
| //won't work, because types don't match | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment