我使用一些第三方库(如 Bootstrap、jQuery、ng2-oauth2、Wijmo 等)创建了一个小项目。我决定使用webpack
. 谁能帮助我如何将这些第三方库包含到我的webpack
实现中?
我在vendor.ts中导入了这样的内容:
// Angular
import '@angular/platform-browser';
import '@angular/platform-browser-dynamic';
import '@angular/core';
import '@angular/common';
import '@angular/http';
import '@angular/router';
// RxJS
import 'rxjs';
// Other vendors for example jQuery, Lodash or Bootstrap
// You can import js, ts, css, sass, ...
import 'bootstrap/dist/css/bootstrap.min.css';
import 'bootstrap-social/bootstrap-social.css';
import 'font-awesome/css/font-awesome.min.css';
import 'angular2-toaster/toaster.css';
import 'jquery/dist/jquery.min.js';
import 'bootstrap/dist/js/bootstrap.min.js';`
这是正确的导入方式吗?它显示了这个错误:
我用过这样的jQuery:
import { Injectable } from '@angular/core';
declare var jQuery: any;
@Injectable()
export class FooterService {
//Get getFooterAlign Service
getFooterAlign(): any {
var getHeight = jQuery(window).height() - 225;
if (jQuery(".body-container").height() < getHeight) {
jQuery(".logInWrapper, .contentWrapper, .signupWrapper").css("height", jQuery(window).height() - 232);
jQuery(window).resize(function () {
jQuery(".logInWrapper, .contentWrapper").css("height", jQuery(window).height() - 225);
});
}
else {
jQuery(".logInWrapper, .contentWrapper, .signupWrapper").css("height", jQuery(".body-container").height());
jQuery(window).resize(function () {
jQuery(".logInWrapper, .contentWrapper").css("height", jQuery(".body-container").height());
});
}
}
}
jQuery 用于将我的页脚部分与动态脚本对齐。
我在代码中犯了什么错误?