34 lines
763 B
TypeScript
34 lines
763 B
TypeScript
/**
|
|
* @license
|
|
* Copyright Google Inc. All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
* found in the LICENSE file at https://angular.io/license
|
|
*/
|
|
|
|
import {Directive} from '@angular/core';
|
|
|
|
/**
|
|
* @description
|
|
*
|
|
* Adds `novalidate` attribute to all forms by default.
|
|
*
|
|
* `novalidate` is used to disable browser's native form validation.
|
|
*
|
|
* If you want to use native validation with Angular forms, just add `ngNativeValidate` attribute:
|
|
*
|
|
* ```
|
|
* <form ngNativeValidate></form>
|
|
* ```
|
|
*
|
|
* @publicApi
|
|
* @ngModule ReactiveFormsModule
|
|
* @ngModule FormsModule
|
|
*/
|
|
@Directive({
|
|
selector: 'form:not([ngNoForm]):not([ngNativeValidate])',
|
|
host: {'novalidate': ''},
|
|
})
|
|
export class NgNoValidate {
|
|
}
|