Angular Resource Encode and Decode URL

Angular Resource Encode and Decode URL

Today, We want to share with you Angular Resource Encode and Decode URL.
In this post we will show you AngularJs Encode and Decode URL example, hear for angular-url-encode – AngularJS Modules, Plugins and Directives we will give you demo and example for implement.
In this post, we will learn about angularjs – Angular Resource Encoding URL with an example.

READ :  Angular Add and remove Active class on click ng toggle

Welcome to the In infinityknow.com website! You will Step By Step learn web programming, easy and very fun. This website allmost provides you with a complete web programming tutorial presented in an easy-to-follow manner. Each web programming tutorial has all the practical examples with web programming script and screenshots available.AngularJs Encode and Decode URL example

AngularJs Encode URL

The encodeURI() javascript function encodes string a Uniform Resource Identifier (URI) in javascript.

Syntax

[php]
encodeURI(URI) //Encode url string
[/php]

Example:

[php]
//Simple print high-low pair ok demo
console.log(“message demo = “+encodeURI(‘\uD800\uDFFF’)); // Encode data
[/php]

Simple Note:

[php]
1st : escape(): It will not be encode string special char: @*/+ // specail
2nd : encodeURI(): It will not encode string special char: ~!@#$&*()=:/,;?+’ // specail
3rd : encodeURIComponent(): It will not encode string special char : ~!*()’ // specail
[/php]

READ :  how to use flashdata in codeigniter?

Example :

js

[php]

var ngApp = angular.module(‘ngApp’, []);
ngApp.filter(‘escape’, function() { // used escape
return window.encodeURIComponent; // in window print
});

[/php]

File index.html

[php]
URL Encode
[/php]

Example 2:

[php]

var sim_uri = “salesorder [email protected]&Userpass=Admin@9898”;
var res_data = encodeURI(sim_uri);
[/php]

Full Example Encode URL:

[php]

JavaScript simple encodeURIComponent() Function with example

<script>

pageurl1 = {{pageurl1}}
salesorderurl2 = {{salesorderurl2}}

[/php]

AngularJs Decode URL

The decodeURI() javascript function decodes a string Uniform Resource Identifier (URI) in javascript.

Syntax

[php]

decodeURI(encodedURI) //Decode url

[/php]

Example Final :

[php]

// base string
http://infinityknow.com/fetch-http-request-headers-php/

// encoded string
http%3A%2F%2Finfinityknow.com%2Ffetch-http-request-headers-php%2F

[/php]

Full Example Decode URL:

[php]

JavaScript Simple decodeURIComponent() Function with Example

<script>

READ :  y2meta 2024 : YouTube Downloader - Download YouTube videos in MP3, MP4, 3GP

BASICURL = {{basicurl}}
customsalesorderurl2 = {{customsalesorderurl2}}

[/php]

Tools AngularJs URL – Encode / Decode

http://codepen.io/benjamincharity/pen/wzyNqQ?editors=1000

Leave a Reply

Your email address will not be published. Required fields are marked *