You can use the native encodeURIComponent
in javascript.
Also, you can make it into a string filter to utilize it.
Here is the example of making escape
filter.
js:
var app = angular.module('app', []);
app.filter('escape', function() {
return window.encodeURIComponent;
});
html:
<a ng-href="#/search?query={{address | escape}}">
(updated: adapting to Karlies’ answer which uses ng-href
instead of plain href
)