Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 2 npm js-sha1 import

I've created angular-cli project. I want to add https://www.npmjs.com/package/js-sha1 so I used command.

npm install js-sha1 ---save

How should I import it then to be able to use it? I'm trying to import it as:

import 'js-sha1';

But when I do:

 sha1('Message to hash');

it says it doesn't know what sha1 is.

like image 634
kamilws Avatar asked Jan 17 '17 09:01

kamilws


1 Answers

Try using

import * as sha1 from 'js-sha1';

for your import.

like image 144
Pieter Coucke Avatar answered Oct 16 '22 14:10

Pieter Coucke