Hi

I am trying to use local storage JSON Object and bind to the polymer 
element but it is not working as expected
Plunker URL for reference 
- http://plnkr.co/edit/z6e7hEyXIk1cd6v4rxXO?p=preview


index.html:


<!DOCTYPE html>
<html>


  <head>
    <script src=
"https://polygit.org/polymer+v2.0.0/shadycss+webcomponents+1.0.0/components/webcomponentsjs/webcomponents-lite.js";
></script>
    <link rel="import" href="my-app.html">
  </head>


  <body>
    <script>
      var temp = [
        {
          "name":"Name",
          "size":"40"
        },
        {
          "name":"Age",
          "size":"20"
        }
      ]
      localStorage.setItem("temp", temp);
    </script>
    <my-app name="localStorage.getItem('temp')"></my-app>
  </body>


</html>:


my-app.html

<link rel="import" href=
"https://polygit.org/polymer+v2.0.0/shadycss+webcomponents+1.0.0/components/iron-ajax/iron-ajax.html";
>
<link rel="import" href=
"https://polygit.org/polymer+v2.0.0/shadycss+webcomponents+1.0.0/components/polymer/polymer-element.html";
>


<dom-module id="my-app">
  <template>
      <label>[[objVal(name)]]</label>
      <input type="text">
      
      <template is="dom-repeat" items="[[objVal(name)]]">
        {{item}}
      </template>
  </template>
  <script>
  
  
  
    class XFoo extends Polymer.Element {
      static get is() { return 'my-app'; }
      
      static get properties() {
        return {
          name: String
        }
      }
      
      objVal(a){
        return eval(a)
      }
      
    }
    customElements.define(XFoo.is, XFoo);
  
  </script>
</dom-module>

Follow Polymer on Google+: plus.google.com/107187849809354688692
--- 
You received this message because you are subscribed to the Google Groups 
"Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to polymer-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/polymer-dev/26a31b36-5db8-4438-a6bf-fe3d20165cac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to