How can I use jquery in my custom widgets? I have code like the following in my controller function:
function ($scope) {
this.doSomething = function(){
$("someSelector")....
//Do stuff
}
}
But when it gets executed I’m getting this error:
ReferenceError: $ is not defined
What do I need to do to utilize jquery in my custom widgets?
Thanks
David
Hi, did you try to add JQuery library as an asset to the custom widget?
Thanks Vincent that does work. I was getting a bit confused because I was under the impressing that jQuery was already available. I was looking at the sources that get pulled into the page and saw that jquery is being pulled in when viewing my form from the portal. (I saw it from a URL like /bonita/portal/scripts/jquery/jquery-1.6.4.js?v=7.0.1). So I wasn’t sure why I couldn’t use it in my forms. I dug in a little more and saw that my form is actually getting displayed in an iframe so it won’t have visibility to the scripts pulled in in the parent frame.
Thanks again
David
Yeah we do wrap custom pages into iframe to avoid conflicts. This is also why we show the preview in an iframe so the JQuery you see from the vendors…min.js is certainly from the UI Designer.
Vincent