Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70429

Format ngui-auto-complete JSON

$
0
0

@PrabhatBees wrote:

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:

{{ model1 | json }}

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.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70429

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>