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中的输入?我会想象
var input = e.$filter(/a-zA-Z/);
我不确定是否理解您的问题,但您可以使用 ngPattern 指令强制输入模式。
<form name="theForm" novalidate> <input type="text" ng-model="foo" ng-pattern="/a-zA-Z/" required/> <button ng-click="update()" ng-disabled="theForm.$invalid">SAVE</button> </form>