AJStacy
AJStacy

Reputation: 5233

How to include behavior within reusable element in Polymer?

I am trying to make a reusable element in Polymer 1.0.

I am running into an issue with canonical paths when trying to load a behavior from within a custom element package.

The behavior is at the same level in my file structure as my custom element.

My current import appears as follows:

<link rel="import" href="extras-behavior.html">

However, I receive this warning:

Behavior ExtrasBehavior not found when mixing properties into mcd-price-calories!

I believe this is due to polyserve and how it converts imports into canonical paths.

Is it possible to do this currently without making the behavior its own bower package?

Upvotes: 1

Views: 55

Answers (1)

AJStacy
AJStacy

Reputation: 5233

I discovered that this actually was not a syntax issue but merely a warning given by Polymer. In order to make sure this warning is not given you must place a comment about your behavior declaration like so:

<script>
  /** @polymerBehavior ConfigBehavior */
  ConfigBehavior = {
  };
</script>

Now Polymer's engine will "know" about your behavior and cease to throw this warning.

Upvotes: 1

Related Questions