I am sure this will work:
export class LongDataList {
constructor() {
this.bindingSpinner = 1;
}
attached() {
this.bindingSpinner = 0;
}
}
And in your template something like this:
<template>
<span if.bind="bindingSpinner">
<i class="fa fa-spinner fa-spin fa-lg"></i>
</span>
<table>
<thead>
<tr>
<th>Username</th>
<th>Password</th>
<th>First name</th>
<th>Last name</th>
</tr>
</thead>
<tbody>
<tr repeat.for="record of records">
<td>${record.user_username}</td>
<td>${record.user_password}</td>
<td>${record.p_fname}</td>
<td>${record.p_lname}</td>
</tr>
</tbody>
</table>
</template>
Finally, if you want the spinner to appear in another module, you can associate the property with the parent component:
<long-data-list binding-spinner.bind="parent-binding-spinner"></long-data-list>
Or you can use Aurelia eventAggregatorto report events to start and stop the counter. However, the first one is simpler.
source
share