Struggling to implement validation on an edit model-view that is data-bound in the activate method of its view-model.
The create.ts file works smoothly with similar code, but without the need to load data. Surprisingly, the validation functions correctly here.
If I remove the data loading code from the activate method of the edit model-view, the validation works as expected.
New to SPA, Aurelia, and TypeScript, seeking some guidance!
Check out the snippet from edit.ts below:
import { ContactRepository } from "./contactRepository";
import { autoinject } from "aurelia-framework";
import { ContactForEditDto } from "./contactForEditDto";
import { json } from "aurelia-fetch-client";
import { inject, NewInstance } from "aurelia-dependency-injection";
import { ValidationRules, ValidationControllerFactory, validateTrigger,
Validator } from "aurelia-validation";
@autoinject
export class Edit {
// implementation mentioned above...
Snippet from edit.html:
<template>
<form id="editContact" submit.delegate="edit()">
<!-- status message placeholders -->
<!-- form content -->
</form>
<div>
<a route-href="route: home"
class="btn btn-default">
Back to list
</a>
</div>
</template>