Angular
March 03, 2022
How To Encode A String In Base64 Using Angular
Today, we will learn about how to encode a string into base64 using Angular.
What is Base64 Encoding?
- Base64 Encoding means of encoding text in ASCII(American Standard Code for Information Interchange) format.
- The Base64 scheme takes any kind of data type, such as binary data, and translates it into text format in ASCII.
- If you want to Encode, the method name is btoa().
- It will be accept the Encoded text btoa(“EncodedText”).
Implementation
Step 1: ng new Demo
Step 2: npm install bootstrap
Modify the angular.json
Modify the styles.css
Step 3: Modify the app.module.ts and import ReactiveFormsModule.
Step 4: Write below code in app.component.ts
Step 5: Write the below code in app.component.html
Step 6: ng serve to show the below output. [Write Text that will be Decoded in Base64]