第一行聚合物定制组件出错

时间:2015-07-13 19:28:26

标签: polymer polymer-1.0

我开始使用Polymer。我正在尝试开发新的Polymer web组件,但Google Chrome会引发错误。

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

<dom-module id="texto-principal">

    <template>
        <!-- bind to the "owner" property -->
        This is
        <b>{{owner}}</b>'s configurable-name-tag element.
    </template>

    <script>
        Polymer({
            is: "texto-principal",
            properties: {
                // declare the owner property
                owner: {
                    type: String,
                    value: "Daniel"
                }
            }
        });
    </script>

</dom-module>

谷歌浏览器在第一行提升:Uncaught SyntaxError: Unexpected token <。 我该如何解决这个问题?

2 个答案:

答案 0 :(得分:3)

使用Polymer注册元素时,id的{​​{1}}应与JavaScript中的dom-module属性匹配。

然后将其导入单独的文件中:

is

然后使用组件:

<link rel="import" href="/path/to/texto-principal.html>

您还可以将<texto-principal></texto-principal> 的值更改为属性:

owner

答案 1 :(得分:0)

我已经找到了重点。

我正在尝试使用asp.net mvc5聚合物,而且我没有以正确的方式导入聚合物库。