I want to use a custom element, bind values to it, check and manipulate them in the view model and show them in the view. This is the container's relevant statements:
<require from = "./../userAccount/userAccount"></require>
<div class="UserAccountWrapper" repeat.for="userAccount of
userAccountsData">
<div><user-account accountDetails.bind="userAccount"></user-account></div>
</div>
This is the custom element relevant code:
import { bindable } from 'aurelia-framework';
export class UserAccount{
@bindable account;
constructor() {}
activate(account) {
this.accountDetails.CompanyName = account.CompanyName == null ? "N/A" :
account.CompanyName;
....
}
The data doesn't get binded to the custom element.
account.bind="userAccount"
in your html andactivate() {
in your js/ts code. – peinearydevelopmentactivate
is not a callback for custom elements. It is for three things: routed components (pages), components created through thecompose
element, and view models for dialogs when using theaurelia-dialog
plugin. – Ashley Grant