Duration: 19:45min
Summary: Angular provides some helpful functions such as angular.element, angular.forEach, and angular.equals. In today's lesson, we will explore some of these functions through examples. We will create a array of grades that contain objects with name and grade. We will use angular.forEach to loop over these objects and put the content in an array. We will then alert that array to view the content. Along the way, we will also experiment with other angular functions. We will convert objects to json, and check whether an object is an array or date. There are many other angular functions listed on the web site that you can experiment with.
We will also explore angular.copy. It creates a deep copy of the source, which should be an object or an array. To illustrate, we will create a form that contains information about cars. In the controller, we will add the car object to the scope, and write a function that copies the car to a new object. This function will be triggered by the button on the form. Then, we will use the angular.element to change the background of the element (through jQuery). Finally, we will check if the two objects are equal.