小编Sye*_*ain的帖子

如何在角度6中使用jquery-ui

我已经尝试在StackOverflow上发布了多个方法,在角度6组件中使用jquery-ui,但它们都没有工作.例如,

  1. 我运行了npm install jquery jquery-ui来安装jquery和jquery-ui.

  2. 包含在angular.json中

    "scripts":["node_modules/jquery/dist/jquery.js","node_modules/jquery-ui-dist/jquery-ui.js",

错误如下:

AppComponent_Host.ngfactory.js [sm]:1ERROR TypeError: jquery__WEBPACK_IMPORTED_MODULE_1__(...).slider is not a function
    at AppComponent.push../src/app/app.component.ts.AppComponent.ngAfterContentInit (http:||localhost:4200/main.js:154:56)
    at callProviderLifecycles (http:||localhost:4200/vendor.js:42663:18)
    at callElementProvidersLifecycles (http:||localhost:4200/vendor.js:42644:13)
    at callLifecycleHooksChildrenFirst (http:||localhost:4200/vendor.js:42634:29)
    at checkAndUpdateView (http:||localhost:4200/vendor.js:43565:5)
    at callWithDebugContext (http:||localhost:4200/vendor.js:44454:25)
    at Object.debugCheckAndUpdateView [as checkAndUpdateView] (http:||localhost:4200/vendor.js:44132:12)
    at ViewRef_.push../node_modules/@angular/core/fesm5/core.js.ViewRef_.detectChanges (http:||localhost:4200/vendor.js:41948:22)
    at http:||localhost:4200/vendor.js:37684:63
    at Array.forEach (native)
Run Code Online (Sandbox Code Playgroud)

的index.html

<!DOCTYPE html>
<html lang="en">
<head>
<title>Car Dealer</title>
</head>
<body>
  <app-root></app-root>
</body> 
</html>
Run Code Online (Sandbox Code Playgroud)

app.component.html

<div id="slider">
</div>
Run Code Online (Sandbox Code Playgroud)

app.component.ts

import { Component, AfterContentInit } from '@angular/core';
import * …
Run Code Online (Sandbox Code Playgroud)

javascript jquery jquery-ui angular angular6

7
推荐指数
1
解决办法
8984
查看次数

标签 统计

angular ×1

angular6 ×1

javascript ×1

jquery ×1

jquery-ui ×1