如何使用角2 jQuery的?

编程入门 行业动态 更新时间:2024-10-21 23:03:45
本文介绍了如何使用角2 jQuery的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我知道如果我我需要的角1.3或1.4。我需要使用第三方库做出的那个东西指令和使用,在我们的项目。现在我使用的角2.0 .I要让这个在角2 jqueryui/autocomplete/ 或这个 jsfiddle/2rgrmv4q/

我可以使用的jQuery 在 angular2 。

1.How我将在角使用第三方库。

2.How我做的角2的jQuery自动完成。

这是我的code plnkr.co/edit/BxMcNXLjVOJBAIiBGL5Y?p=$p$pview

// code放在这里

进口{组件,查看}从'angular2 /核心;@零件({  选择:我的应用  templateUrl:家/ home.html做为',})出口类AppComponent {  构造函数(){} }

解决方案

您只需要声明一个变量,把值或用来初始化变量与您所需的值。在构造函数中,你必须定义 Jquery的部分。看看this.Here工作示例自动完成这是需要你

  

plnkr.co/edit/dAMQc0EN6rSS4dEuTR7E?p=$p$ PVIEW

只是把这个code到构造函数:

出口类AppComponent {  availableTags = [      动作,      AppleScript的      ASP      BASIC,...    ];  构造函数(){    $(#tags).autocomplete({      来源:this.availableTags    });  }}

I know if i I need to use 3rd party library in angular 1.3 or 1.4 .I need to make directive of that thing and use that in our project .Now I am using angular 2.0 .I want to make this in angular 2 jqueryui/autocomplete/ or this jsfiddle/2rgrmv4q/

can I use jquery in angular2.

1.How I will use 3rd party library in angular.

2.How I make auto complete of jquery in angular 2.

here is my code plnkr.co/edit/BxMcNXLjVOJBAIiBGL5Y?p=preview

// Code goes here

import {Component,View} from 'angular2/core'; @Component({ selector:'my-app' templateUrl: 'home/home.html', }) export class AppComponent { constructor() { } }

解决方案

You just need to declare one variable and put values or initilize that variable with the values that your required. in the constructor you have to define Jquery part . take a look at this.Here is working example for Autocomplete which is required to you

plnkr.co/edit/dAMQc0EN6rSS4dEuTR7E?p=preview

Just put this code into the constructor :

export class AppComponent { availableTags = [ "ActionScript", "AppleScript", "Asp", "BASIC",... ]; constructor(){ $( "#tags" ).autocomplete({ source: this.availableTags }); } }

更多推荐

如何使用角2 jQuery的?

本文发布于:2023-10-09 06:12:37,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1474919.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何使用   jQuery

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!