Iterating through the model

Need help with iterating through a model. I am getting the model using this.get(‘buildings’); in a component. However none of the iteration methods seems to be working (tried forEach, filter etc). Its not throwing an error either. I must be doing something really wrong.

building = this.get(‘buildings’); building.forEach(function(item){ console.log(item.get(‘name’)); },building);

Can you pls check whats wrong?

Add console.log(building); after building = this.get('buildings');, maybe it is an empty array. Rest of the code looks fine, there’s noting that would indicate failure.

Thanks @kklisura I found the mistake; was trying to iterate the model/promise too soon.