Questions tagged [jqlite]

jQLite - a jQuery Stand-in for BlackBerry (and other mobile devices)

jqLite is a tiny, API-compatible subset of jQuery that allows AngularJS to manipulate the DOM. jqLite implements only the most commonly needed functionality within a very small footprint, so only a subset of the jQuery API - methods, arguments and invocation styles - are supported.

Project home

149 questions
110
votes
3 answers

How to select an element by classname using jqLite?

I'm trying to remove jquery from my Angular.js app in order to make it lighter, and put Angular's jqLite instead. But the app makes heavy use of find('#id') and find ('.classname'), which are not supported by jqLite, only 'tag names' (as per…
Lior
  • 39,780
  • 12
  • 35
  • 40
47
votes
8 answers

AngularJS - get element attributes values

How do you get an element attribute value? e.g. HTML element: JS: function doStuff(item){ angular.element(item)[0].data('id'); // undefined is not a function } Any…
Iladarsda
  • 10,250
  • 38
  • 99
  • 165
29
votes
3 answers

AngularJS - Image "onload" event

I've been searching for an answer to simple but not trivial question: What is a right way to catch image' onload event in Angular only with jqLite? I found this question , but I want some solution with directives. So as I said, this is not accepted…
Ivan Chernykh
  • 38,282
  • 12
  • 125
  • 141
17
votes
2 answers

iterate a jqlite array

Is there cleaner way to iterate over a set of jqlite elements than the following? var els = angular.element(document.getElementById("main").children); // just as an example for(var i=0, el; el=els[i]; i++) { // do something } I mean, there is…
standup75
  • 4,464
  • 6
  • 23
  • 46
16
votes
2 answers

How to check if element with ID exists in AngularJS

How can I check if an element with a specific ID already exists in my DOM inside an Angular directive? By using angular.element() an element is created if one does not exist, for example angular.element('someID') will return an element whether one…
Dimitris
  • 12,954
  • 17
  • 71
  • 93
12
votes
3 answers

Touch Event Not Returning Touch Data

Edit: "This can't be done in Angular UI Modals" is a valid answer, if that's actually the case. This is the return data I get from a touch event. Conspicuously missing are any useful touch X/Y coords…
VSO
  • 8,950
  • 19
  • 69
  • 148
12
votes
1 answer

Using element.find() by class in Angular Unit testing

When running this test, I keep getting the error Expected undefined to be true. it('should have the right classes', function() { // this doesnt work expect(element.find('.exampleClass').hasClass('ng-hide')).toBe(true); // but this works …
cusejuice
  • 9,375
  • 21
  • 78
  • 133
8
votes
3 answers

.addClass not working on jqLite / Angular.js

I've been struggling lately to understand why the .addClass function was not working on jqLite element.addClass('active') Element returns me an array of html elements, tested that over and over to be sure. I can hide(), show() , add a .css or…
Nkogo
  • 81
  • 1
  • 1
  • 5
6
votes
3 answers

How to test if event.target.hasClass() using angularJS and jqlite?

After a click pass the event to ctrl. I want to write a conditional that will return true if the element.target has the class modal-click-shield Question: How can I use .hasClass() with event.target using angulars' jqlite? Problem: Currently I'm…
Armeen Harwood
  • 15,195
  • 30
  • 106
  • 210
6
votes
2 answers

Using the enter key as tab using only angularjs and jqlite

I have looked at multiple threads and tried a vast variety of solutions. Quite frankly I think I am losing my mind. I have an ng-repeat with inputs. All that needs to happen is that when the user presses enter, it should shift focus to the next…
avn
  • 772
  • 1
  • 9
  • 27
6
votes
2 answers

angularJS element.on callback and scope.$apply

In this example, I have an input with an attached directive. The directive is meant to display messages next to the input. There's another input and a button to add messages. Once some messages are displayed, focusing on the input with the attached…
David V.
  • 5,486
  • 2
  • 24
  • 25
5
votes
3 answers

Instead of $.closest in Angularjs

I want to implement this code in directive but in jQLite this doesn't work How should this be done? var thisCell = element.closest('.sampleclass');
Ehsan Ali
  • 1,030
  • 3
  • 17
  • 44
5
votes
1 answer

Why $document.referrer in angular js returning blank. But when i use document.referrer it is returning me value

var referrer = $document.referrer; Need the value of $document.referrer in a variable.
KRUNAL
  • 81
  • 1
  • 6
5
votes
1 answer

Trigger click event on an AngularJS directive in Mocha test suite

I have a regular angular app with a directive. This directive contains an element with a ng-click="clickFunction()" call. All works well when I click that element. I now need to write a test for this click, making sure that this function was…
miphe
  • 1,306
  • 13
  • 28
5
votes
1 answer

AngularJS unit testing error when using clientWidth

In my code there's a line: var contentWidth = angular.element(document.querySelector('.content'))[0].clientWidth; It works fine when running the app but when unit testing I get error: TypeError: 'undefined' is not an object (evaluating…
Julius
  • 2,413
  • 3
  • 18
  • 26
1
2 3
9 10