0
我正在尝试在一个Angular 4项目中实现物化,它的所有安装和工作。Angular 2+实现jquery
我的问题来了我尝试脚本部分。
例如:
我加入这个我component.html:
<!-- Modal Trigger -->
<a class="waves-effect waves-light btn modal-trigger" href="#modal1">Modal</a>
<!-- Modal Structure -->
<div id="modal1" class="modal">
<div class="modal-content">
<h4>Modal Header</h4>
<p>A bunch of text</p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat">Agree</a>
</div>
</div>
然后说明告诉我使用jQuery来初始化它,所以我将此添加到我的index.html:
<script>
$(document).ready(function(){
$('.modal1').modal();
});
</script>
问题我看不出任何模态出现。
我怎样才能得到这个在Angular 4上工作?
即时得到这个错误:未捕获的ReferenceError:$没有定义 位于localhost /:18 – max2020
是你之前得到相同的消息,与之前的代码? – Vega
你在index.html中做这个吗? – Vega