I have data that looks roughly like this:
"id": "1",
"slug": "WD",
"name": {
"en": "Working Draft",
"de": "Arbeitsentwurf",
"fr": "Version de travail",
"ja": "草案",
"ru": "Рабочий черновик"
}
And I am passing the name object to a component:
{{title-name name=model.name lang='en'}}
In the component template I would like to output the number of translations
<p>Translated {{translationCount}} times.</p>
I tried a few different things in my component to come up with this total but none of them work. How would I count the number of objects?
export default Ember.Component.extend({
// did not work:
translationCount: Ember.computed.alias('Object.keys(name).length'),
// did not work:
// translationCount: Ember.computed.alias('name.length'),
});
Aucun commentaire:
Enregistrer un commentaire