When bind to attributes(one-way) there are a couple of options you can either bind with attr-name.bind="variable" (also tried one-way and one-time) or using interpolation attr-name="${variable}", either way though if you try to bind to a namespaced element such as xlink:href you currently get:
Uncaught NamespaceError: Failed to execute 'setAttributeNS' on 'Element': '' is an invalid namespace for attributes.
For have the following in a controller page.js:
export class page { constructor(){ this.icon = 'blah'; } }
and the following in page.html: <template> <svg class="icon ${icon}"> <use xlink:href="${icon}"></use> </svg> </template>
As I said either of the bind's above is throwing the given error.
Any thoughts on how to bind to this namespaced attribute?
Aucun commentaire:
Enregistrer un commentaire