A simple directive example
AngularJS has its own version of jQuery, known as jQuery Lite. This version has just over 30 methods, some of them a little limited, as is the case with find()
, parent()
, and on()
, among others. AngularJS added some extra methods to the jQuery Lite version such as $destroy()
, injector()
, and inheritedData()
, which is the same as $data()
. Along with many others.
Another important thing to note is that the $
dollar sign has no effect here. The AngularJS equivalent is angular.element
, so something like this:
angular.element() === jQuery() === $()
In most cases, it is sufficient to use the built-in version of jQuery on AngularJS; however, if you require any method that is not listed in the official documentation, you can include the full version of jQuery in your HTML file, always put before the AngularJS script.
Getting ready
In this chapter, we will also use the generator-angm, as we did in the previous chapter.
This time we will call our application jquerydirectives
....