Below is how to bind to remote Data in Kendo Angular.
How do I change the selected dropdown with accepted event that would change the input selected in Kendo dropdown?
https://www.telerik.com/kendo-angular-ui/components/dropdowns/dropdownlist/data-binding/
import { Component, OnInit, Inject } from '@angular/core';
import { DataService } from './data.service';
import { Product } from '../common/product.model';
@Component({
selector: 'my-app',
template: `
<kendo-dropdownlist [data]="listItems"
[textField]="'ProductName'"
[valueField]="'ProductID'"
[defaultItem]="placeHolder" >
</kendo-dropdownlist>
`,
providers: [DataService]
})
export class AppComponent implements OnInit {
public listItems: Array<Product> = [];
public placeHolder: Product = { ProductName: 'Select product...', ProductId: null };
constructor (@Inject(DataService) private dataService: DataService) { }
ngOnInit() {
this.dataService.fetchData().subscribe(
(data) => this.listItems = data
);
}
}
I want inject something like this above in typescript. Say IdSelected = 3,
My Code research
this.dataservice.currentMessage.subscribe(currentMessage => {
this.valueField = currentMessage.IdSelected();
})