How can I use function of other javascript file in ionic project? github

Now I have a ionic v1 example project, I want add I my own js file mqttws31.js to it.
There are many javascript functions in this js file.
In the login.html page
image
when I click blue submit button, it will call a function onConnect() which is defind in my own mqttws31:

In index.html file , I have include “mqttws31.js”:

But when I click submit button, chrome browser shows error following:

ionic.bundle.js:25642 ReferenceError: onConnect is not defined
    at ChildScope.$scope.login (login.js:42)
    at fn (eval at compile (ionic.bundle.js:26457), <anonymous>:4:206)
    at ionic.bundle.js:62386
    at ChildScope.$eval (ionic.bundle.js:29158)
    at ChildScope.$apply (ionic.bundle.js:29257)
    at HTMLButtonElement.<anonymous> (ionic.bundle.js:62385)
    at HTMLButtonElement.dispatch (jquery-1.11.1.min.js:3)
    at HTMLButtonElement.r.handle (jquery-1.11.1.min.js:3)
    at triggerMouseEvent (ionic.bundle.js:2948)
    at tapClick (ionic.bundle.js:2937)

How can I call onConnect() in other js file, How can insert other js file to ionic’s angular framework?

I have update code to github without node_modules directory.
https://github.com/study-note/ionic-social-app-master---copy

Last img for this topic:

Verify Your javascript file the function may be commented

I migrate this js file from other webporject, thats ok, now I just want functions of it in this ionic project.