Search code examples
polymerpolymer-1.0observers

Polymer, observer for object property with numeric key


How to observe an object property with numeric key, as:

"employees":[
     {"1": 0, "2":"John", "3":"Doe"}, 
     {"1": 1, "2":"Anna", "3":"Smith"},
]

Observing whole object works well with: employees.*

But can not target specific property as: employees["2"] . How can specific property be targeted?

Here is Plunk example.


Solution

  • To observe all changes to the 2nd employee in your example, you'd use Deep sub-property changes on array items:

    observers: [
      'bigup(datatable.employees.#1.*)'
    ],
    

    plunker