I’m sorry for the perhaps lame title, but here it is.
I have a list of custom elements of the same type, which has a lot of input fields.
For example, my view has:
<my-custom-element transaction.bind="transaction" repeat.for="transaction in transactions"></my-custom-element> <button click.bind="save">Save transactions</button>
And my custom element looks something like:
<template> <input type="text" value.bind="transaction.name"/> <input type="text" value.bind="transaction.age" /> </template>
I wan’t to handle validation and dirty checking on my custom element, as I think it is the most appropriate.
However, what’s the best way to let my view know wheter theres any dirty transactions or invalid transactions?
I have thinked of passing a common object to all of the my-custom-elements, and then passing in a local ID and any validation errors, and let the view handle it, by disabling the save button for example, and letting the save-function clear the dirty flag of each row.
Is this even remotely the best practice, or what is considered the best practice for my problem?
Many thanks in advance!