我使用来自https://github.com/krescruz/angular-materialize
的角度物化我有以下问题,当我调用模态时,它告诉我控制台上的element.leanModal is not a function
,而是尝试重新加载页面。
所有内容都按顺序包含在内:
<!-- build:js(.) scripts/vendor.js -->
<!-- bower:js -->
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/angular-animate/angular-animate.js"></script>
<script src="bower_components/angular-aria/angular-aria.js"></script>
<script src="bower_components/angular-cookies/angular-cookies.js"></script>
<script src="bower_components/angular-messages/angular-messages.js"></script>
<script src="bower_components/angular-resource/angular-resource.js"></script>
<script src="bower_components/angular-route/angular-route.js"></script>
<script src="bower_components/angular-sanitize/angular-sanitize.js"></script>
<script src="bower_components/angular-touch/angular-touch.js"></script>
<!-- endbower -->
<!-- endbuild -->
<script src="scripts/jquery-1.12.1.min.js"></script>
<script src="scripts/jquery.nicescroll.min.js"></script>
<script src="scripts/materialize.min.js"></script>
<script src="scripts/angular-materialize.js"></script>
<!-- build:js({.tmp,app}) scripts/scripts.js -->
<script src="scripts/app.js"></script>
<script src="scripts/controllers/wallCtrl.js"></script>
<script src="scripts/controllers/about.js"></script>
<script src="scripts/directives/nicescroll.js"></script>
<!-- endbuild -->
以下是模态#newpost
的触发器:
...
<ul class="right hide-on-med-and-down">
<li><a href="/about">About</a></li>
<li><a href="#newpost" modal>New Post</a></li>
</ul>
...
这是模态片段:
<div id="newpost" class="modal modal-fixed-footer">
<form method="post">
<div class="modal-content">
<h4>New Post</h4>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action waves-effect waves-green btn-flat">Post</a>
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat">Cancel</a>
</div>
</form>
</div>
它包含在我app.js
文件的依赖项中:
angular
.module('leseaApp', [
'ngAnimate',
'ngAria',
'ngCookies',
'ngMessages',
'ngResource',
'ngRoute',
'ngSanitize',
'ngTouch',
'ui.materialize'
])
根据文档,一切都正确完成,但我有错误。知道什么可能出错吗?我花了几个小时尝试了一切:通过凉亭和自耕农重新安装东西,降级到旧版本,但到目前为止没有任何作用。任何帮助将不胜感激!
答案 0 :(得分:1)
显然,需要在Angular之前加载jQuery
,以便Angular知道它不必使用jQuerylite。 jQuerylite可以工作,但是MaterialiseCSS有一些完全依赖于jQuery的模块。