How to encode or decode a string in angular 2 with base64 ??? My front-end tool is Angular 2. I had a password string, before passing it to API I n
For encoding to base64 in Angular2, you can use btoa() function.
Example:-
console.log(btoa("stringAngular2")); // Output:- c3RyaW5nQW5ndWxhcjI=
For decoding from base64 in Angular2, you can use atob() function.
console.log(atob("c3RyaW5nQW5ndWxhcjI=")); // Output:- stringAngular2