Skip to content
This repository was archived by the owner on Jul 1, 2020. It is now read-only.

3rd Party Addons

Ghislain B. edited this page Oct 5, 2015 · 3 revisions
Since version `1.4.9` How to validate a 3rd party addon or an array as input? Angular-Validation can also do that, but just make sure you have all the requirement. #####Requirements * You need to provide a `name` (same formular as any other input) * Your ngModel need to be an Array of Strings or Objects. * Array of Objects, you need to provide the name of the Object property to reference for validation. For example the Array `var laptops = [{ id: 0, manufacturer: 'Lenovo' }, { id: 1, manufacturer: 'Toshiba' }];` The object property would be `manufacturer`. We will use `validation-array-objprop=""` for that matter. #####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' }
  ];
Clone this wiki locally