2016-08-30 6 views
0

Ich habe den folgenden Code:Erste ein Polymerelement in JSBin erscheinen

<!DOCTYPE html> 
<html> 
<head> 
    <meta charset="utf-8"> 
    <meta name="viewport" content="width=device-width"> 

    <base href="http://polygit.org/polymer+:master/components/"> 

    <link href="polymer/polymer.html" rel="import"> 

    <link rel="import" href="paper-input/paper-input.html"> 
    <link rel="import" href="paper-dialog/paper-dialog.html"> 

    <title>JS Bin</title> 
</head> 
<body> 

     <paper-input name="some"></paper-input> 
      <paper-input name="some"></paper-input> 

    <my-el></my-el> 

    <dom-module id="my-el"> 
     <template> 
     <style> 
      display: block; 
     </style> 
     I AM HERE! 

      <paper-input name="some"></paper-input> 
      <paper-input name="some"></paper-input> 

     <script> 
      Polymer({ 
      is: "my-el", 

      ready: function(){ 
       console.log("READY!?!"); 
      } 
      }) 
     </script> 
     </template> 
    </dom-module> 

    AND: 

    </body> 
</html> 

die in diesem Jsbin ist: http://jsbin.com/qiyohaj/edit?html,console,output

Sehr einfache questionL warum auf der Erde nicht "x-el" -Display noch laufen ready() ...?

Antwort

1

Sie haben das Skript Teil der webcomponent Schöpfung innerhalb des Vorlage-Tag, wird das Element nie registriert.

Versuchen mit diesem ersetzen:

<dom-module id="my-el"> 
    <template> 
    <style> 
     display: block; 
    </style> 

    <paper-input name="some"></paper-input> 
    <paper-input name="some"></paper-input> 
    </template> 
    <script> 
    Polymer({ 
     is: "my-el", 
     ready: function(){ 
     console.log("ready"); 
     } 
    }); 
    </script> 
</dom-module> 
+0

Aaaaaaaaahhhhhhhhhh !!!!! – Merc

Verwandte Themen