Polymer 0.8 "Unprepared ReferenceError: Polymer not defined"
I recently made the decision to check out Polymer 0.8 rather than just read about it, however I ran into an error: "Uncaught ReferenceError: Polymer is not defined".
I have a feeling that this is really just what I missed, I can't figure out how to figure it out.
Below is my code that I literally copied and pasted from the function overview :
<script src="bower_components/webcomponentsjs/webcomponents-lite.min.js"></script>
<dom-module id="element-name">
<style>
/* CSS rules for your element */
</style>
<template>
<!-- local DOM for your element -->
<div>{{greeting}}</div> <!-- data bindings in local DOM -->
</template>
</dom-module>
<script>
// element registration
Polymer({
is: "element-name",
// add properties and methods on the element prototype
properties: {
// declare properties for the element public API
greeting: {
type: String,
value: "Hello!"
}
}
});
</script>
<element-name></element-name>
Thanks in advance.
source to share
webcomponents-lite.min.js
is a Polyfill for Shadow DOM
and html Imports
, you have to add this to the page main.html
and not to your custom component.
Instead, you should add the Polymer library to which you added Polyfill.
Below is a sample code:
<link rel="import" href="/bower_components/polymer/polymer.html">
<dom-module id="element-name">
<style>
/* CSS rules for your element */
</style>
<template>
<!-- local DOM for your element -->
source to share