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>