This repository has been archived by the owner on Jul 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 58
Global Options
Ghislain B. edited this page Jun 4, 2015
·
38 revisions
To change default options globally, you can use the $scope.$validationOptions
. These global options can be defined for both the Directive and/or the Service.
######Directive/Service
myApp.controller('Ctrl', function ($scope) {
$scope.$validationOptions = {
// set the debounce globally
debounce: 1500,
// set which scope Angular-Validation will use, mainly for $validationSummary and checkFormValidity()
isolatedScope: $scope,
// pre-validate all form elements, false by default
preValidateFormElements: false
};
});
All of these options can also be defined with the Service but this will only works when all your elements have been defined by the Angular-Validation Service ######Service
myApp.controller('Ctrl', function ($scope) {
// start by creating the service
var myValidation = new validationService();
// define the scope and isolatedScope, the scope property always needs to be there
myValidation.setGlobalOptions({
// set the debounce globally
debounce: 1500,
// set which scope Angular-Validation will use, mainly for $validationSummary and checkFormValidity()
// scope & isolatedScope are equivalent but scope is mandatory while isolatedScope is not, so it is suggested to just use scope:
scope: $scope,
isolatedScope: $scope,
// pre-validate all form elements, false by default
preValidateFormElements: false
});
});
Contents
- Angular-Validation Wiki
- Installation
- Demo
- Code Samples
- Functionalities
- Custom Validations
- Properties & Options
- Validators
- Tests
- Misc