How to use CryptoJS with Angular 4

ecain picture ecain · Jul 13, 2017 · Viewed 35.4k times · Source

When I was not using Angular 4, I would just put the script tags for the library. Even when I put the script tags in the index.html file it is not recognizing CryptoJS. Is there a way to use the library or a Angular equivalent?

Answer

CharanRoot picture CharanRoot · Jul 13, 2017

Install using NPM and import below statement in you component file.

npm install crypto-js

import * as crypto from 'crypto-js';

now you can use crypto in your component file.