fail in implement basic element..

34 views
Skip to first unread message

eyal...@gmail.com

unread,
Jul 22, 2014, 4:38:07 AM7/22/14
to polym...@googlegroups.com
Hi,
I'm trying to learn polymer and fail to use a basic polymer element I prepare.
index.html
<!doctype html>
<html>
<head>
  <title>My Test</title>
    <script src="./components/platform/platform.js"></script>
    <link rel="import" href="my-element.html">   
</head>
<body>
  <div>
    <my-element></my-element>
  </div>
</body>    
</html>

my-element.html
<link rel="import" href="./components/polymer/polymer.html">
<polymer-element name="my-element">
<template>
<style>
      div { width: 300px;}
       my-element { font: bold 16px cursive;}
    </style>  
<div>
<p>rtrthdfghdfghdfghdgsdfasdfa</p>
</div>
</template>
</polymer-element>

Now, I see in chrome that all resources are loaded fine (200 OK), yet nothing appears on page.
what's wrong here?

Rob Dodson

unread,
Jul 22, 2014, 9:59:34 AM7/22/14
to eyal...@gmail.com, polymer-dev
Add a noscript attribute to your element:


<link rel="import" href="./components/polymer/polymer.html">
<polymer-element name="my-element" noscript>
<template>
<style>
      div { width: 300px;}
       my-element { font: bold 16px cursive;}
    </style>  
<div>
<p>rtrthdfghdfghdfghdgsdfasdfa</p>
</div>
</template>
</polymer-element>

Or give it a script tag that calls the polymer constructor


<link rel="import" href="./components/polymer/polymer.html">
<polymer-element name="my-element">
<template>
<style>
      div { width: 300px;}
       my-element { font: bold 16px cursive;}
    </style>  
<div>
<p>rtrthdfghdfghdfghdgsdfasdfa</p>
</div>
</template>
    <script>
    Polymer('my-element', {
      // prototype can go here if you want
    });
    </script>
</polymer-element>


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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/2796d771-c2fc-45b6-8272-cd7131275742%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages