[英]Why do I get undefined for application.android.context in nativescript-angular app?
I'm getting the following error while trying to use the nativescript-clipboard plugin within a nativescript-angular app. 尝试在nativescript-angular应用程序中使用nativescript-clipboard插件时出现以下错误。 Because I'm new to nativescript I'm most likely doing something wrong. 因为我是Nativescript的新手,所以我很可能做错了什么。
This is the complete error: 这是完整的错误:
Error in clipboard.setText: TypeError: Cannot read property 'getSystemService' of undefined (/home/linuxtest/sample-ng-todomvc/node_modules/nativescript-clipboard/clipboard.android.js:13:15) I'm Clipboard.setText中的错误:TypeError:无法读取未定义的属性“ getSystemService”(/ home / linuxtest / sample-ng-todomvc / node_modules / nativescript-clipboard / clipboard.android.js:13:15)
currently have version 1.1.3 of the plugin. 当前具有该插件的1.1.3版本。
And here is the section where I'm trying to use your plugin 这是我尝试使用您的插件的部分
import {Component} from "angular2/core";
var clipboardModule = require("nativescript-clipboard");
@Component({
selector: "my-clipboard",
templateUrl: "templates/my-clipboard.html"
})
export class MyClipboard {
greeting:string;
constructor(){
this.greeting = "Hello Github!";
}
save(text) {
clipboardModule.setText(text).then(()=>{
console.log(texto + ", copied to clipboard");
});
}
read() {
clipboardModule.getText().then((content)=>{
console.log("Read from clipboard: " + content);
});
}
}
Thanks in advance! 提前致谢!
I have logged the solution in the issue you have opened in the authors repository but in order for the community to get the answer will post a link here as well. 我已经在作者存储库中打开的问题中记录了解决方案,但是为了使社区获得答案,也将在此处发布链接。 Solution to this problem in the authors repository 在作者存储库中解决此问题的方法
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.