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
Isolated Scope
Ghislain B. edited this page Jun 2, 2015
·
24 revisions
When you have an isolated scope or when you simply do not know which scope holds your complete Form object. This is especially true when you create a dynamic Form or when you create a Form inside a Modal Window.
The problem is more obvious when you want to run the checkFormValidity() or get the $validationSummary.
The way to go around this is to alternatively pass your own isolated scope to the Angular-Validation through the global options.
####Directive Change the Angular-Validation default options
myApp.controller('Ctrl', function ($scope) {
$scope.$validationOptions = { isolatedScope: yourScope };
});####Service From the Service you can also change it the following way. P.S. This only works when all your elements have been defined by the Angular-Validation Service
myApp.controller('Ctrl', function ($scope) {
// start by creating the service
var myValidation = new validationService();
// set property of preValidateFormElements (false by default)
myValidation.setGlobalOptions({ scope: $scope, isolatedScope: yourScope });
// for the Service you could also directly use the scope property
// so this would also work
myValidation.setGlobalOptions({ scope: yourScope });
});Contents
- Angular-Validation Wiki
- Installation
- Demo
- Code Samples
- Functionalities
- Custom Validations
- Properties & Options
- Validators
- Tests
- Misc