Q:

AngularJS: Escape HTML in input fields

What is the best way to escape HTML in the input field?  For example, I've search input field 
<input id="search" type="text" ng-model="search" placeholder="search...">

And I want to escape if somebody types something like this:
<script>alert("test123");</script>

A:

this completely depends on your use case.  If you just want it to escape it for the users view (so basically sanitizing) you can use angular $sanitize & $sce for it
https://docs.angularjs.org/api/ngSanitize/service/$sanitize and https://docs.angularjs.org/api/ng/service/$sce
however if you want to store it somewhere and want it escaped, you can build a filter.  You can find an example here: Escape HTML text in an AngularJS directive

