I am using APi The access to this api is done with hash key that we need to send to the api but we don't really know how to implement.
I found https://www.npmjs.com/package/crypto-js but i dont know how to integrate angular 2
also i found https://www.npmjs.com/package/angular-md5 but i dont know how to import using angular 2 typscript
For angular 2 use
npm install ts-md5 --save
then import it into component, service or wherever you want
import {Md5} from 'ts-md5/dist/md5';
When you are using systemJS is neccessary set map and package paths.
map: {
'ts-md5': 'src/js/ts-md5',
},
packages: {
'ts-md5': {main: '/md5.js'},
}
This is the example from one of my project where I copy neccessary libraries to separate file structure.
You can get a md5.ts file here:
https://github.com/ManvendraSK/angular2-quickstart/blob/master/app/md5.ts
import it in your component/service:
import {md5} from './md5'; //make sure it points to the folder where the md5.ts file is
then you can use it in your component/service:
let e = md5(this.email);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With