Issue
In my project, two modules here(Staff, Agent ). I click Agent module list and URL shows Agent /list and update one Agent , URL passing id corresponding id . But i want encrypted data passing update and list in URL. So how to pass encrypted (user not understanding) values in Angular 6
return this.repository.postData('api/agent/list', requestObj);
Solution
import { ActivatedRoute } from '@angular/router';
constructor(public route: ActivatedRoute, ) {}
You can access your params in this way on your onInit function:
const abc = this.activatedroute.snapshot.params['abc'];
const xy = this.activatedroute.snapshot.params['xy'];
Note: your url should be something like localhost:4200/lib/123/32
then your sosid will have the value 123 and xy will have the value 32.
The way you want to encrypt and decrypt is up to you. Theare infinite ways to do that. It just depends by you. For example you can decide to shift every ASCII key by one when encoding, and then shitf them back when decoding.
For example, if you decide that shift and the url is .../lib/353/47, then the real data will be :
abc : 242
xy : 36
Answered By - Naveen
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.