Hi,
I have a list of hard-coded objects as:
public Heroes = [{
id : ‘1’,
name : ‘John Smith’
},{
id : ‘2’,
name : ‘Peter Parker’
},
{
id : ‘3’,
name : ‘Bruce Wayne’
}
];
I am using, autocompleteListFormatter as:
autocompleteListFormatter = (data: any): SafeHtml =>{
let html = <span>${data.id}</span>
;
return this._sanitizer.bypassSecurityTrustHtml(html);
}
and, my html file looks like this:
<ion-content padding>
<input ngui-auto-complete
[(ngModel)]="model1"
[source]="Heroes"
[open-on-focus]="false"
display-property-name = "id"
[list-formatter] = "autocompleteListFormatter"
placeholder="enter text"/>
{{ model1 | json }}
</ion-content>
When I run this, I get the desired output.
{ “id”: “1”, “name”: “John Smith”}
However, I would like those curly brackets removed, and get these data in nicely html formatted without Id and Name field, like:
1
John Smith
This must be simpler than I thought, but I have been looking for it since 2 days, and could not find a way. I am a newbie, and learning Ionic since a month. If someone know the way, please do help.
Thank you.