Closed martinobordin closed 7 years ago
Try to give a default value to your "customers" array, like this:
export class CustomerEditComponent implements OnInit {
customers: Array<Customer> = []; // empty array for initial value
constructor(private customerService: CustomerService) { }
ngOnInit() {
this.customerService
.getAll()
.subscribe(x => this.customers = x);
}
}
Alternatively, you can use the RxJS startWith
operator like this:
this.customerService
.getAll()
.startWith([])
.subscribe(x => this.customers = x);
@martinobordin Let me know if this works so I can close this.
@matsura Initializing the array the error disappears but the list is empty
@martinobordin I will create a test case to verify if this is a bug and report back.
@matsura Thank you very much
@martinobordin I have published a new version to npm(0.1.1). I will now close this, reopen or open a new issue if the bug persists.
Hi, I'm trying to use it with an array that is loaded via observable (REST API) but I get an error. Is it a unsupported scenario or am I using it in the wrong way?
Here my component:
Here how I use your component:
Here the error I get in the Chrome console: