0
我使用打字稿&角2.我有一个EncryptionService:如何从我的打字稿文件导入JavaScript文件?
import {Injectable} from 'angular2/core';
import './lib/hmac256-enc64';
@Injectable()
export class EncryptionService {
constructor() {
}
hmacSha256(message: string, secret: string) {
return CryptoJS.HmacSHA256(message, secret).toString(CryptoJS.enc.Base64);
}
}
我想包括” ./lib/hmac256-enc64' ; (CryptoJS)但在运行时出现错误:
检测为寄存器但未执行。
如何在我的EncryptionService中包含Js文件作为依赖项?
这篇文章得到它为我工作。在system.js映射中注册它。 – Baconbeastnz