【发布时间】:2019-02-17 01:08:44
【问题描述】:
尝试使用离子存储设置值时,我不断得到未定义的值。 虽然我确实在 console.log 的第一个实例上看到了控制台中的值
查看代码中的输出值:
GeneratePBKDF2(pbkdf2Password) {
console.log("New password created: " + pbkdf2Password);
// Output: New password created:PBKDF2$sha256$901$89G9D/PkC521fqOt$9gNgGt6rkhs5UeVlp2oJfI0l3CLpUgk6
this.storage.set("TempPass", pbkdf2Password);
// Error output: Uncaught TypeError: Cannot read property 'storage' of undefined
console.log("Test Output" + pbkdf2Password);
// Output: null
}
Start() {
var password = PasswordGenerator.generate({length: 20,numbers: true});
MosquittoPBKDF.createPasswordAsync(password, this.GeneratePBKDF2);
}
【问题讨论】:
标签: ionic3 typescript2.0