Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polymer::Attributes: couldn`t decode Array as JSON #1693

Closed
ghost opened this issue May 31, 2015 · 4 comments
Closed

Polymer::Attributes: couldn`t decode Array as JSON #1693

ghost opened this issue May 31, 2015 · 4 comments

Comments

@ghost
Copy link

ghost commented May 31, 2015

Hi i having a issue when try to use is="dom-repeat"

Polymer::Attributes: couldn`t decode Array as JSON

This is my component

<link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="import" href="../../bower_components/iron-media-query/iron-media-query.html">
<link rel="import" href="../../bower_components/iron-icons/iron-icons.html">
<link rel="import" href="../../bower_components/paper-drawer-panel/paper-drawer-panel.html">
<link rel="import" href="../../bower_components/paper-header-panel/paper-header-panel.html">
<link rel="import" href="../../bower_components/paper-icon-button/paper-icon-button.html">
<link rel="import" href="../../bower_components/paper-item/paper-item.html">
<link rel="import" href="../../bower_components/paper-material/paper-material.html">
<link rel="import" href="../../bower_components/paper-menu/paper-menu.html">
<link rel="import" href="../../bower_components/paper-toolbar/paper-toolbar.html">

<dom-module id="rb-layout">

<link rel="import" type="css" href="layout.css">

  <template>
    <paper-drawer-panel id="drawerPanel" responsive-width="1024px" drawer-width="{{drawerWidth}}">

      <paper-header-panel class="list-panel" drawer mode="seamed">

        <!-- List Toolbar -->
        <paper-toolbar class$="{{toolbarClass}}"></paper-toolbar>

        <!-- List -->
        <paper-menu class="list" on-iron-activate="_listTap">
          <template is="dom-repeat" items="menuItems">
             <paper-item> 
                <span>{{item.name}}</span>
             </paper-item>
          </template>
        </paper-menu>

      </paper-header-panel>

      <paper-header-panel class="main-panel" main mode="{{mainMode}}">

        <!-- Main Toolbar -->
        <paper-toolbar class$="{{toolbarClass}}">
          <paper-icon-button icon="menu" paper-drawer-toggle></paper-icon-button>
        </paper-toolbar>

        <div class="content">

          <paper-material>
            <!-- Card Content -->
          </paper-material>

        </div>

      </paper-header-panel>

    </paper-drawer-panel>

    <iron-media-query query="(max-width: 780px)" query-matches="{{_isMobile}}"></iron-media-query>

  </template>

  <script>

    Polymer({

      is: 'rb-layout',

        ready: function() {
        this.menuItems = [
         {name: "Projectos", description: "Lista de proyectos", anchor: "/:id/projecstList"},
         {name: "Facturas", description: "Registro de Pagos", anchor: "/:id/invoiceList"},
         {name: "Soporte", description: "Crear un ticket", anchor: "/ticket"}
        ];
      },

      properties: {
        _isMobile: {
          type: Boolean,
          observer: '_isMobileChanged'
        }
      },
      _listTap: function() {
        this.$.drawerPanel.closeDrawer();
      },
      _isMobileChanged: function(isMobile) {
        this.mainMode = isMobile ? 'seamed' : 'cover';
        this.drawerWidth = isMobile ? '100%' : '320px';
        this.toolbarClass = isMobile ? '' : 'tall';
        this.updateStyles();
      },

    });
  </script>

</dom-module>```
@arthurevans
Copy link

Should be items="{{menuItems}}".

@azumbrunnen
Copy link

Good point. Might need a better error message.

@gabrielkw
Copy link

Stumbled in the same problem. My <template is="dom-repeat" items="_memberUids" as="uid"> should be <template is="dom-repeat" items="[[_memberUids]]" as="uid">. This definitely needs a better error message.

@raffaeu
Copy link

raffaeu commented Feb 22, 2017

Same error, I pass values from ASP.NET MVC into my Polymer views using reflectToAttribute and then I forgot {{ inside the attribute items="" of my template is="dom-repeat"
A better error message would help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants