私はAngular2プロジェクトにangular-cliとWebpackを使用しています。Webpack - ブートストラップツールチップを使用できません
私は、jquery、bootstrap.css、およびbootstrap.jsファイルをangular-cli.jsonファイルからグローバルにロードしました。設定がbelow-与えられます。
"styles": [
"../node_modules/bootstrap/dist/css/bootstrap.min.css",
"styles.css"
],
"scripts": [
"../node_modules/jquery/dist/jquery.min.js",
"../node_modules/bootstrap/dist/js/bootstrap.min.js"
],
私もDefinetlyTypedからブートストラップタイピングファイルをダウンロードし、私が欲しいのコンポーネントで/// <reference path="@types/bootstrap" />
を使用して、参照としてそれらを追加しています。
しかし、私は、ツールチップの初期化機能
$('[data-toggle="tooltip"]').tooltip();
を実行していたとき、私は、エラー - を得続ける:
Typeerror_handler.js:53TypeError: __WEBPACK_IMPORTED_MODULE_2_jquery__(...).tooltip is not a function
at HeaderComponent.ngAfterViewInit (http://localhost:4200/main.bundle.js:759:73)
at CompiledTemplate.proxyViewClass.View_AppComponent0.detectChangesInternal (/AppModule/AppComponent/component.ngfactory.js:74:74)
at CompiledTemplate.proxyViewClass.AppView.detectChanges (http://localhost:4200/vendor.bundle.js:69363:14)
at CompiledTemplate.proxyViewClass.DebugAppView.detectChanges (http://localhost:4200/vendor.bundle.js:69456:44)
at CompiledTemplate.proxyViewClass.View_AppComponent_Host0.detectChangesInternal (/AppModule/AppComponent/host.ngfactory.js:29:19)
at CompiledTemplate.proxyViewClass.AppView.detectChanges (http://localhost:4200/vendor.bundle.js:69363:14)
at CompiledTemplate.proxyViewClass.DebugAppView.detectChanges (http://localhost:4200/vendor.bundle.js:69456:44)
at ViewRef_.detectChanges (http://localhost:4200/vendor.bundle.js:51541:20)
at http://localhost:4200/vendor.bundle.js:36682:84
at Array.forEach (native)
は私が間違って何をしているのですか?
誰かがこれで私を助けることができますか?私はtypeahead.jsを使用しなければならないときにも同じアプローチを使用しましたが、完璧に機能しましたが、なぜここで動作しませんか?
' "../ node_modules /ストラップ/ DIST/JS/bootstrap.min.js"'パスをチェックアウト。これには本当の 'js'フォルダがありますか、' bootstrap.min.js'は実際に存在していますか? – Jai
@Jaiありがとうございます。 –
@ ng.newbieこの解決策を見つけましたか? – Yasir