You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using a polymer attribute inside Angular will fail, since attribute$ is not a valid attribute name and Angular uses Element.setAttribute() when creating the template.
Ex:
<!-- This is an Angular template declaring a Polymer template --><iron-list[items]="items"><ng-templatepolymer-template[modelHost]="this"><!-- Neither of these work --><paper-itemclass$="[[getClass(item)]]">[[item]]</paper-item><paper-item[attr.class$]="[[getClass(item)]]">[[item]]</paper-item></ng-template></iron-list>
In this example, we're using [modelHost] referring to the Angular component, which has a getClass() property. We want to dynamically get the class for an element inside a Polymer template. If we want to bind the value to an attribute, we must use the attribute$ binding syntax.
The problem is this isn't "HTML", this is markup that Angular creates using the DOM programatically. So it will attempt to call paperItemEl.setAttribute('class$', '[[getClass(item)]]') which fails.
The text was updated successfully, but these errors were encountered:
This would set the className property, which has a similar effect. There may be other use cases where one would want to set an attribute in a Polymer template though. If it's not possible, it should be documented.
hotforfeature
changed the title
Polymer attribute binding fails
Polymer $attribute binding fails
May 16, 2017
hotforfeature
changed the title
Polymer $attribute binding fails
Polymer attrinbute$ binding fails
May 16, 2017
hotforfeature
changed the title
Polymer attrinbute$ binding fails
Polymer attribute$ binding fails
May 24, 2017
Using a polymer attribute inside Angular will fail, since
attribute$
is not a valid attribute name and Angular usesElement.setAttribute()
when creating the template.Ex:
In this example, we're using
[modelHost]
referring to the Angular component, which has agetClass()
property. We want to dynamically get the class for an element inside a Polymer template. If we want to bind the value to an attribute, we must use theattribute$
binding syntax.The problem is this isn't "HTML", this is markup that Angular creates using the DOM programatically. So it will attempt to call
paperItemEl.setAttribute('class$', '[[getClass(item)]]')
which fails.The text was updated successfully, but these errors were encountered: