Is it possible in Aurelia to use vanilla js setAttribute()
with custom attributes? When I inspect the dom, the change is made on the custom element, but it doesn't seem to trigger anything in my model or view no matter what I try. Is there a "best practice" way to do this?
home.ts
export class Home{
public onButtonClicked():void{
document.getElementById('test123').setAttribute('color', 'green');
}
}
home.html
<template>
<require from="../../elements/now-loading-circle/now-loading-circle"></require>
<button click.delegate="onButtonClicked()">Click</button>
<now-loading-circle id="test123" color="red"></now-loading-circle>
</template>
now-loading-circle.ts
import {bindable, autoinject} from 'aurelia-framework';
@autoinject
export class NowLoadingCircle{
@bindable color:string;
public colorChanged(newValue):void{
alert(newValue);
}
}
now-loading-circle.html
<template>
<svg viewBox="0 0 120 120">
<circle repeat.for="circ of coords" cx="${circ.x}" cy="${circ.y}" r="${smallCircleRadius}" class="circ-${$index + 1}"></circle>
</svg>
</template>