Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/30.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 模块没有导出的成员';Md5';?_Angular_Typescript_Md5 - Fatal编程技术网

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