Angular2输入字段的验证

时间:2016-06-22 06:53:56

标签: angular

//验证所需的步骤

1. handle validation on a input field upto 2 decimals using angular2.For Ex: 1-99.
2. Have input field accept only numeric values

// Html代码在这里

  <input ngControl="Text" name="Text" max="2" type="number" autocomplete="off"/>

因为一切都是用Html处理但是我正在考虑用角度2进行句柄验证

所以我的问题是如何处理Angular 2的验证

先谢谢!!

1 个答案:

答案 0 :(得分:0)

Angular会处理验证。只需将<input>放在<form>标记内。

有关详细信息,请参阅https://angular.io/docs/ts/latest/guide/forms.html

我还发现https://www.youtube.com/watch?v=ihYc9y7dQA0非常有帮助。

相关问题