Skip to content Skip to sidebar Skip to footer

Using The @bindable Attribute On Child Class In Aurelia

For the current project at work, we are creating quite a few custom controls that all share the same properties and that are bindable. @bindable required: boolean = false; @bindabl

Solution 1:

As a work-around until inheritance with bindable properties gets supported in Aurelia, I am binding to a class that has some of the shared properties. The bindable ones will get duplicated across the controls for now.

import {bindable, bindingMode} from "aurelia-framework";
import {IControlBase, ControlBase} from "./controlbase";

export class MyClass {
  @bindable controlbase: IControlBase = new ControlBase();
  @bindable label: string = "";
  @bindable editing: boolean = false;
  @bindable({ defaultBindingMode: bindingMode.twoWay })
  value: string;
}

Post a Comment for "Using The @bindable Attribute On Child Class In Aurelia"