Polymer Matrix Push 0.9 with Repeat Pattern

I am using Polymer 0.9 and I have this template.

<template>
    <ul>
        <template is="dom-repeat" items="{{menuPages}}">
            <li class="c-text">
                <span>{{item.title}}</span>
            </li>
        </template>
    </ul>
</template>

      

When I use this snippet to update the data, it doesn't load

    ready: function () {
        this.menuPages.push({title:'hey'});
        this.menuPages.push({title:'hey2'});
    }

      

However it works

    ready: function () {
        this.menuPages = [{title:'hey'}, {title:'hey2'}];
    }

      

Working example

Broken example

+3


source to share


1 answer


To trigger DOM updates, you will need to use this:

this.push('menuPages', {title:'hey'});

      



Documentation: https://www.polymer-project.org/1.0/docs/devguide/templates.html#dom-repeat

+14


source







All Articles