Tutorialsplane

AngularJs Encode URL


AngularJs Encode URL Example : We can use the javascript inbuilt function encodeURIComponent(string), encodeURI(string) or escape(string) to encode the url string. Here in this tutorial we are going to explain how you can encode url string with example and online demo.


AngularJs Encode URL Parameters | String | JavaScript | Example

Let us create a simple example to use the function encodeURIComponent(string) to encode the url parameters.

AngularJs Encode URL Parameters: Example



 
 

  
<div ng-app="myApp">  
<div ng-controller="myController">  
    <button ng-click="encodeUrlStr()">Encode URL</button>
	<br/>
	URL1 = {{url1}}<br/>
	URL2 = {{url2}}
</div> 
</div>
  
                                                                                                                

Try it ยป

If you run the above example it will produce output something like this โ€“

Note:

Keep in mind the difference between the three functions before using them.