Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何使用 Angular 允许文本输入、数字和一个点?
我在 html 上有这个:
<input type="text" ng-pattern="/^[0-9.]*$/" />
但我只想允许一个点。
任何想法?
似乎您想允许十进制或整数。
^[0-9]+(?:\.[0-9]+)?$