admin 管理员组文章数量: 1086019
I'm getting the error ReferenceError: $ is not defined on my ionic application.
I'm trying to open links in the systems browser from my json file.
Here's the code:
$timeout(function () {
$('.ex-link').click(function () {
var url = $(this).attr('href');
window.open(encodeURI(url), '_system', 'location=yes');
return false;
})
})
Line which gets the error is:
$('.ex-link').click(function () {
I'm getting the error ReferenceError: $ is not defined on my ionic application.
I'm trying to open links in the systems browser from my json file.
Here's the code:
$timeout(function () {
$('.ex-link').click(function () {
var url = $(this).attr('href');
window.open(encodeURI(url), '_system', 'location=yes');
return false;
})
})
Line which gets the error is:
$('.ex-link').click(function () {
Share
Improve this question
asked Jul 16, 2015 at 11:30
smither123smither123
3574 gold badges6 silver badges22 bronze badges
3
-
1
jQuery included?? Angular will use jqLite. However you can include jQuery.js before Angular.js and make Angular replace jqLite by jQuery.
$
will be difined. – Sudhansu Choudhary Commented Jul 16, 2015 at 11:42 - So in my index.html i need to add jquery? – smither123 Commented Jul 16, 2015 at 11:45
- yeas and before including AngularJS – Sudhansu Choudhary Commented Jul 16, 2015 at 11:46
1 Answer
Reset to default 7Angular will use jqLite. However you can include jQuery.js before Angular.js and make Angular replace jqLite by jQuery. $ will be difined.
Include jQuery before including AngularJS as,
<!-- Add jQuery from -->
<script type="text/javascript" src="jquery.js"></script>
<!-- And then AngularJS -->
<script type="text/javascript" src="angularjs.js"></script>
本文标签: javascriptIonic ReferenceErroris not definedStack Overflow
版权声明:本文标题:javascript - Ionic: ReferenceError: $ is not defined - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://roclinux.cn/p/1744084743a2530912.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论