TypeError: t.fx undefined when trying to add jQuery-UI to an Angular 4 application

I am trying to add jQuery-UI to the application, since I need access to some sliders. I set icons for jQuery with:

npm install @types/jquery --save

And what are the jQuery-UI pictograms with apparently

npm install @types/jqueryui --save

I added jQuery and jQuery-UI CDN links to 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 message:

t.fx is undefined     jquery-ui.min.js:6

While Chrome throws:

cannot read property 'step' of undefined at <String>.anonymous

In the same line. Can someone tell me the correct method to add jQuery-UI to an Angular 4 project?

+6
source share
1 answer

JQuery Slim removes some of the features that the JQuery user interface relies on.

Replace

  <script
    src="https://code.jquery.com/jquery-3.2.1.slim.min.js"
    integrity="sha256-k2WSCIexGzOj3Euiig+TlR8gA0EmPjuc79OEeY5L45g="
    crossorigin="anonymous">

FROM

<script src="http://code.jquery.com/jquery-3.2.1.min.js"
        integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
        crossorigin="anonymous"></script>
+5

Source: https://habr.com/ru/post/1016906/


All Articles