Ricardo Silva
Ricardo Silva

Reputation: 1384

Error in first line of polymer custom component

I'm getting started with Polymer. I'm trying develop new Polymer web component, but google chrome is raising error.

<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>

Google Chrome is raising: Uncaught SyntaxError: Unexpected token < in first line. How can I solve this?

Upvotes: 0

Views: 90

Answers (2)

sounakpal
sounakpal

Reputation: 106

The id of the dom-module should match the is property in the JavaScript when registering the element with Polymer.

And then import it in a separate file:

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

and then to use the component:

<texto-principal></texto-principal>

you can also change the value of owner by using it as an attribute:

<texto-principal owner="John"></texto-principal>

Upvotes: 3

Ricardo Silva
Ricardo Silva

Reputation: 1384

I already found the point.

I'm trying polymer with asp.net mvc5, and I was not importing polymer library in the right way.

Upvotes: 0

Related Questions