Angular 模块没有导出的成员';Md5';?
因此,我基本上导入:Angular 模块没有导出的成员';Md5';?,angular,typescript,md5,Angular,Typescript,Md5,因此,我基本上导入: 从'ts-Md5/dist/Md5'导入{Md5}; 但它说: Module has no exported member Md5? 但它工作得很好,问题是它在编译时给了我一个错误 我将其更改为小写md5,如: 从'ts-md5/dist/md5'导入{md5}; 但现在我的功能不起作用: hashIt(电子邮件:string){ this.hashString=md5.hashStr(电子邮件); log(this.hashString); } 它说: Prope
从'ts-Md5/dist/Md5'导入{Md5};
但它说:
Module has no exported member Md5?
但它工作得很好,问题是它在编译时给了我一个错误
我将其更改为小写md5,如:
从'ts-md5/dist/md5'导入{md5};
但现在我的功能不起作用:
hashIt(电子邮件:string){
this.hashString=md5.hashStr(电子邮件);
log(this.hashString);
}
它说:
Property 'hashStr' does not exist on type '(string : any) => string'.
确保它已安装
npm安装--保存ts-md5
直接将其导入必须使用它的组件中:
import { Component } from '@angular/core';
import {Md5} from 'ts-md5/dist/md5';
@Component({
selector: 'my-app',
templateUrl: './app.component.html',
styleUrls: [ './app.component.css' ]
})
export class AppComponent {
name = 'Angular';
md5 = new Md5();
ngOnInit(){
console.log(this.md5.appendStr('hello').end());
}
}
正在工作,如果仍然不工作,请尝试npm卸载ts-md5
然后npm安装--保存ts-md5