У меня есть массив, который содержит данные, но его длина равна нулю. Я не могу понять эту странную природу. Буду признателен за помощь.
//Component code
val1=[];
updateData(){
this.val 1 = this.service.getData() // Using Behavior Subject to get the Data from service
console.log(this.val1);// Displays the values
console.log(this.val1.length);//Displays 0
}
checked(event){
console.log(this.val1);// Displays the values
console.log(this.val1.length);//Displays correct length
}
//Service code
getBackendData(){
//call to backend and create a list
this.behaviorSubjectObj.next(List);
}