AngularJs Decode URL

AngularJs Decode URL String Example : We can use the javascript inbuilt function decodeURIComponent(uri), encodeURI(uri) or escape(uri) to decode the uri string. Here in this tutorial we are going to explain how you can decode the uri string with example and online demo.

AngularJs Encode URL| URI Component | JavaScript | Example

Let us create a simple example to use the function dcodeURIComponent(uri) to decode the uri component.

AngularJs Decode URI Component: Example

<!DOCTYPE html>
<html lang="en">
 <script src="//"></script>
 var myApp = angular.module("myApp", []);
 myApp.controller("myController", function($scope) {
  $scope.url1 = '';
  $scope.url2 = '';
  $scope.encodeUrlStr = function() {
   $scope.url2 = "" + decodeURIComponent($scope.url1);
<div ng-app="myApp">  
<div ng-controller="myController">  
    <button ng-click ="encodeUrlStr()" >Decode URL</button>
	URL1 = {{url1}}<br>
	URL2 = {{url2}}

Try it »

If you run the above example it will produce output something like this –

AngularJs Encode URL| URI Component | JavaScript | Example


Add Comment

📖 Read More