问题
I'm using Angular2, and I'd like to include jQuery.
systemjs.config.js
(function (global) {
System.config({
paths: {
'npm:': 'node_modules/',
'jquery': "//code.jquery.com/jquery-2.1.4.min.js"
},
meta: {
bootstrap: {
deps: ['jquery']
}
},
.....
}
In app.module.ts, I got the error : Cannot find the module 'jquery' when I put :
import $ from 'jquery';
I try it using map instead of paths, but the same result..
回答1:
The correct code is ..
import * as $ from 'jQuery';
Also should u be mapping to a CDN?
When not get jQuery via NodeJS or save jQuery locally and map to it?
来源:https://stackoverflow.com/questions/40236090/systemjs-loading-jquery