Tuesday 15 May 2012

angularjs - angular.element vs document.getElementById or jQuery selector with spin (busy) control -


I am using the "fingerprints" version of the spin control, as recorded here:

One of the things I have not liked about the solution explained to me is the use of jQuery in the service, which effectively connects the DOM element to the spin control. I like to use the angular structure to use the element. I also wish to avoid "hard-coding" which requires the spinner to be attached to the service and instead use a command which sets a singleton in the service so that other users of the service Or the service itself does not need to know this.

Which angle is I struggling with. Element tells us which document is. GetElementById gives us on the same element ID as such. This works:

  var target = document.getElementById ('epubointindicator');   

None of these:

  var target = angular Element ('#Epubasi indicator'); Var target = angular Element ('epubus indicator');   

I am clearly doing something which should be quite obviously wrong! Can anyone help?

Let's say I can do the above work, I have a similar problem in trying to change jQuery access to an element: eg $ (target) FadeIn ('fast') ('sharp') or angular.element ('appBusyIndicator'). FadeIn ('sharp') works angular.element ('# appBusyIndicator'). Code> No

Does anyone point me to a good example of the document which makes it clear by creating a correction "element" vs. DOM element? The angle expressly "wraps" the element with its properties, methods etc. But it is often difficult to obtain the original value. For example if I have a & lt; Input type = 'number' & gt; is the field and I want to access the original content that appears in Yuri, when the user type "-" (without quotation marks) I could not find anything, probably because "type = number" The angle is rejecting the input even though it appears in the UI and I want to see it so that I can test it and make it empty.

thanks

it can Work like this:

  var myElement = angular.element (document.query selector ('# -s- id'));   

You wrap the call in the angular.element () call. So you always get the element in the jqLite or jQuery object, depending on whether jQuery is available / loaded or not.

If jQuery is available, then angular.element a jQuery function Is the nickname for If jQuery is not available, then jQuery of the underlying subset of angular.element delegates angular , which is called "jQuery Light" or JqLite < / Strong>.

Element All element references always jQuery or jqLite (such as logic argument logic compile or link in a logic). They are never raw; DOM reference

No comments:

Post a Comment