Repository navigation
Jquery error #435
Description
Activity
Probably caused by the type definition.
Replace the following lines at the bottom of the files
../typings/browser/ambient/jquery/index.d.tsand../typings/main/ambient/jquery/index.d.tsdeclare module "jquery" { export = $; } declare var jQuery: JQueryStatic; declare var $: JQueryStatic;with:
declare module "jquery" { export = jQuery; } declare var jQuery: JQueryStatic;After that you should be able to import jQuery as
import 'jquery';. I briefly checked it so most likely not the cleanest solution. Hope it helps though.Notice
You need to usejQueryinstead of$if you followed the changes above.@kschio the files ../typings/browser/ambient/jquery/index.d.ts and ../typings/main/ambient/jquery/index.d.ts don't exists. In the file ../typings/jquery/jquery.d.ts , replace
declare module "jquery" { export = $; } declare var jQuery: JQueryStatic; declare var $: JQueryStatic;with:
declare module "jquery" { export = jQuery; } declare var jQuery: JQueryStatic;but not working if you import jquery in the files that you need and use jQuery instead of $...
Installation I've followed has been: https://codedump.io/share/kQF7Ts1Iu5d/1/how-to-use-jquery-with-angular2
Thanks for help
this is not a good approach, as anyone(including you) who will get the code and install it on some other workstation will not have this change. It's something you need to remember or put as as post step when running typings install.. :(
This issue has been around for years. I've removed the protractor typings for now but will do this as a post install step to fix it ..
@samvloeberghs I agree, that's why I stated that this is not a clean solution but I didn't find the time to provide something yet.
Let me know if you work on this or if I can help you out.
this is not a good approach, as anyone(including you) who will get the code and install it on some other workstation will not have this change. It's something you need to remember or put as as post step when running typings install.. :(
This issue has been around for years. I've removed the protractor typings for now but will do this as a post install step to fix it ..
If i uninstall protractor typings, i just get another error:
Cannot find type definition file for 'protractor'.
How can i make this go away?If i uninstall protractor typings, i just get another error:
Cannot find type definition file for 'protractor'.
How can i make this go away?Ok i just had to remove "protractor" from
tsconfig.jsontypes
I followed the instruction over wiki on how to install jquery.
I got the following error :
Subsequent variable declarations must have the same type. Variable '$' must be of type 'cssSelectorHelper', but here has type 'JQueryStatic'.
and when i do
import $ from "jquery" it shows jquery module doesn't exist??
Thanks for help any!!!!