简体   繁体   中英

Polymer single page app not working

I have created a single page polymer app and when I run node app.js the app is not being displayed.

index.html

<!doctype html>
<html>
  <head>
    <script src="/bower_components/webcomponentsjs/webcomponents.js"/>
    <link rel="import" href="/bower_components/polymer/polymer.html">
    <link rel="import" href="/bower_components/core-icon/core-icon.html">
    <link rel="import" href="/bower_components/paper-input/paper-input-decorator.html">
    <link rel="import" href="/bower_components/paper-icon-button/paper-icon-button.html">
    <link rel="import" href="/bower_components/paper-shadow/paper-shadow.html">
    <link rel="import" href="/bower_components/paper-card/paper-card.html">
    <link rel="import" href="news-api.html">
  </head>
  <body>
    <news-api></news-api>
  </body>
</html>

news-api.html

<dom-module id="news-api">
  <template>
    <span>{{message}}</span>
  </template>

  <script>
    Polymer({
      is: 'news-api',
      properties : {
        message: {
          type: String,
          value: "Hello world!"
        }
      }
    });
  </script>
</dom-module>

I am just posting my polymer code because the node.js part seems to be working fine. Please pardon me if I have made some dumb mistakes, I am new to polymer and node.js.

Found out the issue. The problem is with your self-closing script tag . Please check this link to know more about this problem. Replacing

<script src="/bower_components/webcomponentsjs/webcomponents.js"/>

with

<script src="/bower_components/webcomponentsjs/webcomponents.js"></script>

should fix your problem

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM