I have a dialog as you can see here:
<template>
<ux-dialog>
<ux-dialog-body>
<h2 t="luminaires.list.enter-serialnumber">Bitte geben Sie eine neue Seriennummer ein</h2>
<input value.bind="serialNumber" />
</ux-dialog-body>
<ux-dialog-footer>
<button click.trigger="controller.cancel()" t="luminaires.list.cancel">Abbrechen</button>
<button click.trigger="controller.ok(serialNumber)" t="luminaires.list.ok">Ok</button>
</ux-dialog-footer>
</ux-dialog>
</template>
and related view-model:
import {DialogController} from "aurelia-dialog";
import {Controller} from "aurelia-templating";
export class SerialnumberDialog {
private static inject = [DialogController];
private serialNumber: string;
private controller: any;
constructor(controller: Controller) {
this.controller = controller;
}
}
I want to change the color of the following sentence sometimes.
<h2 t="luminaires.list.enter-serialnumber">Bitte geben Sie eine neue Seriennummer ein</h2>
For example when some body give a repetitious serial number, I want to change the colour to red. I can open the dialog through the following code:
this.dialogService.open({ viewModel: SerialnumberDialog, lock: false })
.whenClosed((response) => {......
I want to use Aurelia concept for this purpose. Could you please tell me the solution?
...
` in the markup. And `activate(){ if(//serial number is repetitious){ conditionaClass = "my-red"; } }`, where `conditionalClass` defaults to and empty string in the VM. – Benny Halperin Jul 21 '17 at 16:27