Show [Object,Object] after iterate the array in html in ionic 3?


#1

Hello to all,
I have to show the selected categoryObject inside the model but in my case i show[Object,object ] inside the model tell m anyone how to fix this and how to show selected object in the model?
```
type or paste code here

    public categoryObject :any;
	private userSubCategoriesDtos :any = [];
	constructor(
			public params: NavParams,
			public viewCtrl : ViewController
		) {
		this.categoryObject         = this.params.get('categoryObject');
		this.userSubCategoriesDtos  = this.categoryObject.userSubCategoriesDtos;
	}

		<ion-list *ngFor="let subCatgory of userSubCategoriesDtos">
			<ion-label>{{subCatgory}}</ion-label>
		</ion-list>

#3

What is the format of the data you are expecting? I would say you would need to map through the array and maybe iterate through the object in order to see the value you want.

.map for the array and inside the .map method use “for in” for the object.


#4

sir,
i have to iterate this array this.categoryObject.userSubCategoriesDtos how to use with map method?.


#5

sorry for the late reply but my recommendation would be to check out the Mozilla Developer Network as they have a better explanation that I could give you.

but I would do something lke this:

myArray.map(myObject => display.show(myObject.myProperty) );

where display.show() is a made up object and method and you should use your own.

EDIT: DIsregard, I must be blind.

In your case:

<ion-list *ngFor="let subCatgory of userSubCategoriesDtos">
	<ion-label>{{subCatgory.myProperty}}</ion-label>
</ion-list>

but again I don’t know the format of the data you’re expecting so I can’t help you further.