A
A
Alexey Yarkov2016-06-13 17:44:28
Angular
Alexey Yarkov, 2016-06-13 17:44:28

How to get the name of an object's key without knowing how many there are?

Task:
We have an array of objects of the form

[
{title: "Title", description: "Description", secret: {ХЗ СКОЛЬКО СВОЙСТВ ОБЪЕКТА И ИМЕН ТОЖЕ НЕ ЗНАЕМ},
{title: "Title 2", description: "Description 2", secret: {ХЗ СКОЛЬКО СВОЙСТВ ОБЪЕКТА И ИМЕН ТОЖЕ НЕ ЗНАЕМ 2}
]

I'm trying to output in a nested ng-repeat:
td.item-title
    editable-text(value='item.title')
td.item-secret(ng-repeat='secretItem in Keeper.data[{{$index}}].secret')
    editable-text(value='secretItem.$КАК_ССЫЛАТЬСЯ_НА_СВОЙСТВО_ОБЪЕКТА_secret$',)
td.item-description
    editable-text(value='item.description')

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anatoly, 2016-06-13
@yarkov

Excuse me for the reaction, but how could a fly not go in and read the very first example of the angular documentation? https://docs.angularjs.org/api/ng/directive/ngRepeat
Iterating over object properties
Is documentation really that hard? What is the generation of Stackoverflowers?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question