BigRetroMike BigRetroMike - 9 months ago 54
JSON Question

Editing data retrive from api inside Ember.js application

I'm new to all those frameworks/js thing - so sorry if I want to do something that I'm not allowed.

I'm retrieving json data from api of another application.

In ember component I would like to display data from that json but because It can be a very long string I would like to display only first 256 characters.
I'm displaying it via {{my_model.summary}} is there a way to cut it after 256 characters so it wont break the app view ?

Answer Source

You can write your own helper as shown in Ember Guides or you can use an addon, for example ember-composable-helpers's slice helper:

{{slice 0 255 my_model.summary}}