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(undefined) // false
angular.isDefined(null) // true
The function angular.isUndefined
tests if a value is undefined (it is effectively the opposite of angular.isDefined
)
angular.isUndefined(someValue)
This is the equivalent of performing
value === undefined; // will evaluate to true is value is undefined
Or just
!angular.isDefined(value)
Examples
angular.isUndefined(42) // false
angular.isUndefined(undefined) // true