在全球范围内加载的Jquery在Angularjs 2应用
问题描述:
我需要有可用的jQuery到我的我的应用程序,这样我可以使用这样在全球范围内加载的Jquery在Angularjs 2应用
进口的jQuery的所有组成部分;并在所有组件中使用jquery api
我正在使用SystemJS,Angular 2和typescript。我怎样才能做到这一点?
问候
答
您需要导入您的应用程序的jQuery $和必须配置您的systemjs装载机在jQuery库将可
//in your typescript angular2
import * as $ from 'jQuery';
// in your systemjs configuration
//map
(function(global) {
// map tells the System loader where to look for things
var map = {
'app': 'app', // 'dist',
'jQuery': 'node_modules/jQuery/lib/node-jquery.js',
};
您还可以导入它在你的HTML的index.html像下面
System.import('jQuery').catch(function(err){ console.error(err); });
调整你的自我,使工作
+0
非常感谢你,它的作品就像一个魅力.. .. – shabari
POSS Ible重复[如何使用jQuery与Angular2?](http://*.com/questions/30623825/how-to-use-jquery-with-angular2) – Fiddles