我知道如果我我需要的角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的?
发布评论