Skip to content

Instantly share code, notes, and snippets.

@Armenvardanyan95
Created June 24, 2017 11:38
Show Gist options
  • Save Armenvardanyan95/664fd87e77b29fa2166680d1cea67e42 to your computer and use it in GitHub Desktop.
Save Armenvardanyan95/664fd87e77b29fa2166680d1cea67e42 to your computer and use it in GitHub Desktop.
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