I have a Au2 component with a bindable property like:
export class MyComponent {
@bindable
prop: string;
}
Is there any way to find out if the property has been bound or not?
<my-component prop="abc"></my-component> // is bound
<my-component prop.bind="undefined"></my-component> // is bound
<my-component></my-component> // is *not* bound
Thanks for any help!
UPDATE:
It would work like this, but I don’t know weather this is a “public” api:
binding(initiator: IHydratedController, parent: IHydratedController)
{
const myPropIsBound = parent.bindings.some(b => b['targetProperty'] === 'prop' && b.isBound);
}
IHydratedController
is available in ‘@aurelia/runtime-html’ namespace, but targetProperty
is missing in typescript type (IBinding
).