16

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?

1
  • well i need answer too
    – holms
    Jun 21, 2017 at 0:21

1 Answer 1

32

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>
1
  • Uncaught TypeError: t.fx is undefined
    – pogeybait
    Jan 19, 2021 at 11:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.