【发布时间】:2017-05-20 03:49:27
【问题描述】:
我收到错误:this.$modal.modal 不是函数
我通过 gulp 文件从 wwwroot 文件夹中的 Node_Module 获取 ng2-bs3-modal。
我的文件夹结构是:
- wwwroot
- angularlibs
- angular
- bootstrap
- core-js
- rxjs
- zone.js
- ng2-bs3-modal
- appScripts (js generated from typescripts)
- Scripts (typescripts)
- typings
- gulpfile
- package.json
- project.json
- .....
如果我将 ng2-bs3-modal 移动到 Script (typescript) 文件夹,它会给出 jasmin zone.js 错误。使用上述结构,我收到“this.$modal.modal is not a function”错误,因为来自 ng2-bs3-modal 的所有打字稿都没有找到 @angular/core。
index html 中的脚本标签按以下顺序:
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" ref="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/css/bootstrap.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.0/jquery.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/js/bootstrap.js"></script>
我尝试通过以下几个选项来解决: https://github.com/dougludlow/ng2-bs3-modal/issues/52 https://github.com/dougludlow/ng2-bs3-modal/issues/34
但没有运气。我是 angular2 的新手。快速帮助将不胜感激。
【问题讨论】:
-
你在用cli吗?
标签: angular bootstrap-modal ng2-bootstrap