jQWidgets Forums
jQuery UI Widgets › Forums › Angular › $ is not defined .net core angular vs2017
This topic contains 2 replies, has 2 voices, and was last updated by sdemon 8 years, 2 months ago.
-
Author
-
Hi, Your product looks very promising and I was evaluating your framework before making the enterprise purchase but unfortunately I couldn’t get past this error. Please advise.
“Exception: Call to Node module failed with error: ReferenceError: $ is not defined
at jqxMenuComponent.createComponent…..”If i test for $ within my app component i would get valid jquery object but not when that code is from within your component (being called from main-server.js) webpack
Here are the steps to reproduce. i am running this on asp .net core 1.1 and angular2 template.
1. i installed aspnetcore spa template by using “dotnet new –install Microsoft.AspNetCore.SpaTemplates::*”
2. I then created a new VS project using “dotnet new angular”
The app runs fine from within vs2017. Then I add in your framework using “npm install jqwidgets-framework”
I would then get the error as mention in this article http://www.jqwidgets.com/community/topic/vs-2017-asp-net-angular-2/
I would follow his fix and the errors resolved3. I start using your component within the nav-menu component by wrapping the ul within the jqxmenu.
<jqxMenu #menuReference [width]=’670′ [height]=’30’>-
…..
</jqxMenu>
4. update app.component.ts to declare your menu component
5. update views/ index.cshtml to have the script tag including jquery.js and jqxcore.js, jqxmenu.js (this is weird as i assume the webpack would take care of this, why would I have to include the js file in the main page but that’s a different topic)
6. Run the program i would get the error above. I tried to play with the webpack to include
plugins: [
new webpack.ProvidePlugin({
jQuery: ‘jquery’,
$: ‘jquery’,
jquery: ‘jquery’
})
]but the problems remain. As mentioned earlier i tested for jquery $ within my navmenu.component.ts and it’s fine, only your app components don’t have access to jquery
Can you please advise?
Thanks
Hi,
This may be because you want to use some jquery dependency but you don`t have the typings for it.
Best Regards,
IvojQWidgets Team
http://www.jqwidgets.com/The code is being called within jqwidgets’ component in “jqxMenuComponent.createComponent” method.
$ is not defined
at jqxMenuComponent.createComponent…..” -
AuthorPosts
You must be logged in to reply to this topic.