I’d like to be able to set an arbitrary id while declaring custom elements in the markup. This will enable some advanced component scenarios such as dependant drop down lists.
I don’t think I can do that, because I’m having a custom element which I’m using around. So I’d like to assign an id to that element in the HTML template.
You could place a bindable attribute in your component and then assign it inside your view template.
import { bindable } from 'aurelia-framework';
export class MyComponent {
// default random ID (you could make this a two-way binding if you'd like to either assign it manually or get the random default set value)
@bindable theId = `id-${Date.now()}`;
}