user1834664
user1834664

Reputation: 451

Accessing external JavaScript function and class from angularjs controller

I am very new to Angularjs. I have an external java script called client.js. This file has a function

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;
}
}

Now in angularjs controller file i want to access the function declared in client.js

var client = new Client();
client.getVersion();

Please help me how to achieve this.

Upvotes: 1

Views: 2739

Answers (1)

Vlad Gurovich
Vlad Gurovich

Reputation: 8463

assuming the client.js file is loaded before the controller that is trying to use it, i dont see a problem with doing what you outlined inside the controller function.

If that doesnt work, create a plunker the demonstrates the issue

Upvotes: 1

Related Questions