1

Is there a way to filter through inputs in Angular? I'd Imagine

var input = e.$filter(/a-zA-Z/);
1

1 Answer 1

1

I'm not sure to understand your question, but you can force a pattern on an input with the ngPattern directive.

<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>
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, I didn't know ng-pattern does that, but ng-pattern doesn't filter, it only validates. is there a filter that can say ng-filter ="/a-zA-Z/" and only take input of alphabets

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.