TypeError: t.fx is undefined when attempting to add jQuery-UI to Angular 4 app
angular, jquery, jquery-ui, npm, typescript
Solution
Jquery Slim removes some features that Jquery UI relies on.
Replace
<script
src="https://code.jquery.com/jquery-3.2.1.slim.min.js"
integrity="sha256-k2WSCIexGzOj3Euiig+TlR8gA0EmPjuc79OEeY5L45g="
crossorigin="anonymous">
With:
<script src="http://code.jquery.com/jquery-3.2.1.min.js"
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
crossorigin="anonymous"></script>
Problem
I am trying to add jQuery-UI to an application, as I need access to some sliders. I have installed the typings for jQuery with: ``` npm install @types/jquery --save ``` And what seem to be the jQuery-UI typings with ``` npm install @types/jqueryui --save ``` I have added the jQuery and jQuery-UI CDN references to the index.html ``` <!doctype html> <html> <head> <meta charset="utf-8"> <title>SimutronApp</title> <base href="/"> <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha256-k2WSCIexGzOj3Euiig+TlR8gA0EmPjuc79OEeY5L45g=" crossorigin="anonymous"> </script> <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js" integrity="sha256-VazP97ZCwtekAsvgPBSUwPFKdrwD3unUfSGVYrahUqU=" crossorigin="anonymous"> </script> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="icon" type="image/x-icon" href="favicon.ico"> </head> <body> <app-root>Loading...</app-root> </body> </html> ``` However, in Firefox I get the error: ``` t.fx is undefined jquery-ui.min.js:6 ``` While Chrome throws: ``` cannot read property 'step' of undefined at <String>.anonymous ``` At the same line. Could anyone tell me the correct method for adding jQuery-UI to an Angular 4 project?