I work on angular 7 I face issue countrows variable give me undefined value
although I assigned it with value as below
Expected result I need is to get value 3 from returned array of object
public Countrows:Number; ngOnInit(): void { countitems() console.log("final count rows is" + this.Countrows);
} countitems() { this._inventory.GetcountItems().subscribe( data =>this.Countrows=data[0].countItems
) } it give me final data undefined
data returned on variable Countrows
[ { "countItems": 3 } ]
What I have tried:
console.log("final data" + data[0].countItems) give me on console as final data 3