我对 Angularjs 很陌生。 我有一个名为 client.js 的外部 java 脚本。这个文件有一个功能
function Client() {
_instance_ = this;
this.client = null;
this.clientType = null;
}
ArcotClient.prototype.setAttribute = function(key, value, value2) {
if (key.toLowerCase() == "flashupdateurl") {
if (value != null) {
this.flashUpdateURL = value;
}
} else if (key.toLowerCase() == "javainstallurl") {
if (value != null) {
this.javaInstallURL = value;
}
}
ArcotClient.prototype.getVersion(){
return version;
}
}
现在在 angularjs Controller 文件中我想访问 client.js 中声明的函数
var client = new Client();
client.getVersion();
请帮助我如何实现这一目标。
最佳答案
假设 client.js 文件在尝试使用它的 Controller 之前加载,我认为执行您在 Controller 函数中概述的操作没有问题。
如果这不起作用,请创建一个 plunker 来演示问题
关于javascript - 从 angularjs Controller 访问外部 JavaScript 函数和类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19831175/