This next group of functions can be executed from anywhere in Angular without having to inject them. They are mainly utility functions that allow you to do things easier or do things the Angular way.
This provides a way to combine two objects:
angular.extend(srcObject, destObject)
In JavaScript, there is no in-built way to extend an object using another object. This function does just that.
Here is a simple example that will extend one object with the other's property:
var first = { first: '1' }; var second = { second: '2' }; var extended = angular.extend(first, second); //extended will be {first:'1', second:'2'}