Validation is being used on both the AngularJS side and server side to check for duplicate values, and I want to show these errors to users. Previously, without using ng-fab-form, I created a custom server error directive and implemented it like this:
<input type="number" id="level" name="level" ng-model="vm.record.level"
server-error
required>
<div ng-messages="vm.form.role_level.$error">
<p ng-message="server">{{ vm.errors.level }}</p>
</div>
However, the main purpose of the library is to eliminate this repetitive process. With the use of "Controller as" syntax, I assign errors to each field when there are issues saving or updating the model:
angular.forEach(result.data.errors, function (errors, field) {
vm.form[field].$setValidity('server', false);
vm.errors[field] = errors.join(', ');
});
I have customized the validation template to display messages for server errors, but I am struggling to show dynamic error text. It seems to be related to scope inheritance. Any suggestions on how I can achieve this desired effect?