This repository was archived by the owner on Jul 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 55
3rd Party Addons
Ghislain B. edited this page Oct 5, 2015
·
14 revisions
Since version 1.4.9
What if you want to validate an input which is an Array of Strings or is using a 3rd party addon? Well Angular-Validation can now validate that too. As long as you follow the requirement and the code examples, you should be fine.
#####Requirements
- Input element requires a
nameattributes. - ngModel needs to be filled and need to be an Array of Strings or an Array of Objects
- Array of Objects, for
Angular-Validationto work it needs to know which object property you want to reference. Examplevar laptops = [{ id: 0, manufacturer: 'Acer' }, { id: 1, manufacturer: 'Lenovo' }];The property we would most probably like to to validate ismanufacturerin this case.
- Array of Objects, for
#####Code Sample This only work with the Directive for now. ######Directive (html) HTML Code
<!-- Example with ngTagsInput addon -->
<tags-input name="input1"
ng-model="vm.tags1"
validation="in_list:Tag4,Tag5|required"
validation-array-objprop="text">
</tags-input>JavaScript Code
myApp.controller('Ctrl', ['validationService', function (validationService) {
var vm = this;
var myValidation = new validationService({ controllerAs: vm, formName: 'vm.test' });
vm.tags1 = [
{ id: 1, text: 'Tag1' },
{ id: 2, text: 'Tag2' },
{ id: 3, text: 'Tag3' }
];Contents
- Angular-Validation Wiki
- Installation
- Demo
- Code Samples
- Functionalities
- Custom Validations
- Properties & Options
- Validators
- Tests
- Misc