简体   繁体   中英

How to disable form-validation in Ionic 3 and Angular 4?

The forms in Ionic Framework 3 with Angular 4 validates <ion-input/> and <ion-textareas/> automatically. As soon as I blur the input field, it gets validated and the border color changes ( in my case ) to green.

  <ion-item margin-top>
    <ion-label stacked>Form Label</ion-label>
    <ion-textarea type="text" rows="6" [(ngModel)]="variable"></ion-textarea>
  </ion-item>

Is it possible to disable automatic form-validation in Ionic 3?

Note: If I remove [(ngModel)]="variable" , the validation will be left out.

Change rather add inside src/theme/variables.scss the following lines of code:

// Ionic variables override
$text-input-ios-show-focus-highlight: false;
$text-input-md-show-focus-highlight: false;
$text-input-wp-show-focus-highlight: false;

There will be one disadvantage. While removing the focus highlight, you will lose all kind of highlights.

Note: Original answer by sebaferreras : How to remove default color in input type?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM