There are certain ways to encode or decode string in angulars. In this code snippet we will take a look a very simplest way:
Lets see how we can do the same in JQuery
Encoding
$.base64.encode("Demo test text");
Decoding
$.base64.decode("aghTcycpcyBhIHRlc3Q=");
Try this when using IE10+
var decod = window.atob(str); var encode = window.btoa(str);
Here is the way using AngularJS
var app = angular.module("encodeDecode", []); app.controller("encodeDecodeCtrl", ($scope, str) => { $scope.encode = btoa(str); $scope.decode = atob(str); });
The post Encode or decode strings using angularJS appeared first on Gaurav-Arora.com.