Ionic2中输入验证错误的CSS类

时间:2016-09-13 17:44:59

标签: ionic2

当输入验证无法突出显示输入(红色)时,是否可以设置任何类?

1 个答案:

答案 0 :(得分:1)

这些类由Ionic添加到ion-inpution-select元素:

State                          Class if true    Class if false
-----                          -------------    --------------
Control has been visited       ng-touched       ng-untouched
Control's value has changed    ng-dirty         ng-pristine
Control's value is valid       ng-valid         ng-invalid

因此,您可以使用ng-touchedng-invalid在该字段中显示错误消息。