1

Most of the guides say that it is not a problem just download jquery and the typings file and then edit the typings file to remove the export $ part

The problem with that is that I need to export $ since the plugins I'm going to use expect jquery to be defined as $

How can I use jquery with angularjs2 with exporting the global $ jquery variable

4
  • @WojciechKwiatek no its not good because they remove the '$' from the exports or I didn't understand it well and '$' will still refer to jquery? doesnt angularjs2 uses '$' for something else so we cant bind to it jquery? Commented Jun 8, 2016 at 17:29
  • The answer which is there is about deleting typings for that. You can still use jquery with a script tag or attach jquery imported from npm to window.$ Commented Jun 8, 2016 at 17:33
  • @WojciechKwiatek oh I see can you explain to me why did we need to remove the $ from the typings? which module in angularjs2 uses that? and if I just include a <script> tag to jquery in my page which will bind $ to my window object, will it work fine with angularjs2? Commented Jun 8, 2016 at 17:59
  • From the link: "tslint will give you an error since $ conflicts with protractor Subsequent variable declarations must have the same type. Variable '$' must be of type 'cssSelectorHelper', but here has type 'JQueryStatic'" Angular should not complain about global $ variable. Commented Jun 8, 2016 at 18:03

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.