Tutorial by Examples

The angular.equals function compares and determines if 2 objects or values are equal, angular.equals performs a deep comparison and returns true if and only if at least 1 of the following conditions is met. angular.equals(value1, value2) If the objects or values pass the === comparison If b...
The function angular.isString returns true if the object or value given to it is of the type string angular.isString(value1) Examples angular.isString("hello") // true angular.isString([1, 2]) // false angular.isString(42) // false This is the equivalent of performing typeof s...
The angular.isArray function returns true if and only if the object or value passed to it is of the type Array. angular.isArray(value) Examples angular.isArray([]) // true angular.isArray([2, 3]) // true angular.isArray({}) // false angular.isArray(17) // false It is the equivalent of ...
The function angular.merge takes all the enumerable properties from the source object to deeply extend the destination object. The function returns a reference to the now extended destination object angular.merge(destination, source) Examples angular.merge({}, {}) // {} angular.merge({name...
The function angular.isDefined tests a value if it is defined angular.isDefined(someValue) This is the equivalent of performing value !== undefined; // will evaluate to true is value is defined Examples angular.isDefined(42) // true angular.isDefined([1, 2]) // true angular.isDefined(un...
The angular.isDate function returns true if and only if the object passed to it is of the type Date. angular.isDate(value) Examples angular.isDate("lone star") // false angular.isDate(new Date()) // true
The angular.isNumber function returns true if and only if the object or value passed to it is of the type Number, this includes +Infinity, -Infinity and NaN angular.isNumber(value) This function will not cause a type coercion such as "23" == 23 // true Examples angular.isNumber...
The function angular.isFunction determines and returns true if and only if the value passed to is a reference to a function. The function returns a reference to the now extended destination object angular.isFunction(fn) Examples var onClick = function(e) {return e}; angular.isFunction(onCli...
The function angular.toJson will take an object and serialize it into a JSON formatted string. Unlike the native function JSON.stringify, This function will remove all properties beginning with $$ (as angular usually prefixes internal properties with $$) angular.toJson(object) As data needs to ...
The function angular.fromJson will deserialize a valid JSON string and return an Object or an Array. angular.fromJson(string|object) Note that this function is not limited to only strings, it will output a representation of any object passed to it. Examples: angular.fromJson("{\"yo...
The angular.noop is a function that performs no operations, you pass angular.noop when you need to provide a function argument that will do nothing. angular.noop() A common use for angular.noop can be to provide an empty callback to a function that will otherwise throw an error when something ...
The angular.isObject return true if and only if the argument passed to it is an object, this function will also return true for an Array and will return false for null even though typeof null is object . angular.isObject(value) This function is useful for type checking when you need a defined ...
The angular.isElement returns true if the argument passed to it is a DOM Element or a jQuery wrapped Element. angular.isElement(elem) This function is useful to type check if a passed argument is an element before being processed as such. Examples: angular.isElement(document.querySelector(&q...
The angular.copy function takes an object, array or a value and creates a deep copy of it. angular.copy() Example: Objects: let obj = {name: "vespa", occupation: "princess"}; let cpy = angular.copy(obj); cpy.name = "yogurt" // obj = {name: "vespa", ...
The angular.identity function returns the first argument passed to it. angular.identity(argument) This function is useful for functional programming, you can provide this function as a default in case an expected function was not passed. Examples: angular.identity(42) // 42 var mutate = f...
The angular.forEach accepts an object and an iterator function. It then runs the iterator function over each enumerable property/value of the object. This function also works on arrays. Like the JS version of Array.prototype.forEach The function does not iterate over inherited properties (prototype...

Page 1 of 1