Created
June 24, 2017 11:37
-
-
Save Armenvardanyan95/2a3e1cb6c12a25b3ce451826b2fe7c11 to your computer and use it in GitHub Desktop.
This file contains 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[] = [{value: 1, label: 'Armen Vardanyan'}, {value: 2, label: 'Also Armen Vardanyan'}]; | |
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