I have a HTML form that is being built up dynamically from a given "product" object and the fields that it has, allowing the user to modify the associated data. I am using a custom "editor" directive to handle the creation of the HTML elements needed to allow the user to update the data.
An example can be seen here: http://plnkr.co/edit/2fAVVpwTHFgxwTq4eAMI
Firstly, I'm not sure if this is the best way to achieve this, but it does (so far) seem to work okay. (Any other idea's welcome!)
However, I want to add validation rules to the controls, eg. require
so that a message appears when the input is left empty. I have attempted to add these validation rules into the code (as seen in the template in the directive), but it never fires. I'm pretty sure it's something to do with me getting my scope wires-crossed somewhere... AngularJS Batarang is showing on the main scope an object of:
form: {
{{fieldName}}: {}
}
Which is obviously wrong (and nonsense!)