AngularJS angular.isElement() Function (original) (raw)
Last Updated : 05 Sep, 2022
The angular.isElement() Function in AngularJS is used to determine if the parameter inside isElement function is a HTML DOM element or not. It returns true if the reference is a DOM element or else false.
Syntax:
angular.isElement(value)
Parameter:
- value: It is used to validate whether the passed argument is an HTML DOM element or not.
Return Value: It returns a boolean value, i.e, returns true if the value passed is an HTML DOM element or else returns false.
Example: This example illustrates the use of the angular.isElement() Function in AngularJS.
HTML `
angular.isElement()GeeksforGeeks
angular.isElement()
Input1:
{'destroy': true, 'create': false}
isElement: {{ isElement1 }}
Input2:
window.getElementByID('myButton')
isElement: {{ isElement2 }}
Button
`
Output:
Example 2: This is another example that describes the angular.isElement() Function in AngularJS, by checking both the input values whether it is HTML DOM element or not.
HTML `
angular.isElement()GeeksforGeeks
angular.isElement()
Input1:
["DSA", "Algo", "Web Tech"]
isElement: {{ isElement1 }}
Input2:
window.getElementByID('myDiv')
isElement: {{ isElement2 }}
Div element
`
Output: