Failed to start a simple polymer application

OK .. I set up the Polymer Project because it’s in This video

Project Structure:

enter image description here

My custom item:

<link rel="import" href="../bower_components/polymer/polymer.html">
<polymer-element name="hello-world" noscript>
<template>
    <h1>Hi From Custom Element</h1>
</template>
</polymer-element>

index.html:

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Title of the document</title>
<script type="text/javascript" src="bower_components/polymer/polymer.js">
</script>
<link rel="import" href="elements/hello-world.html">
</head>
<body>
<hello-world></hello-world>
</body>
</html>

OK .. When I run this code without a server, I get an error message:

 Imported resource from origin 'file://' has been blocked from loading by Cross-Origin Resource Sharing policy: Received an invalid response. Origin 'null' is therefore not allowed access.

and when I run the application on WAMP, I get an error:

Uncaught HierarchyRequestError: Failed to execute 'appendChild' on 'Node': Nodes of type 'HTML' may not be inserted inside nodes of type '#document'. 
 Uncaught TypeError: object is not a function

in polymer.js any help in this case?

+4
source share
1 answer

Due to the nature of the polymer, you cannot just run things with a URI file:. See https://www.polymer-project.org/docs/start/reusableelements.html

script bower_components/webcomponentsjs/webcomponents.js bower_components/polymer/polymer.js.

+3

All Articles