AngularJS – isObject() method

The isObject() method in AngularJS basically checks if a reference is an Object or not. This method will return True if the reference passed inside the function is an Object, else it will return False.

Note − NULL values are not considered as an Object, but JavaScript arrays are objects.

Syntax

angular.isObject(value)

Example − Check if the reference is an Object or not

Create a file "isObject.html" in your Angular project directory and copy-paste the following code snippet.


   
      angular.isObject()

      
   

   
      

         Welcome to Tutorials Point      

     

AngularJS | angular.isObject()

     
      Value: {{value}}      

      {{isObject}}      

      Value: null      

      {{isObject1}}      

      Value: {{value3}}      

      {{isObject2}}      

      Value: {{value4}}      

      {{isObject3}}    
       

Output

To run the above code, just go to your file and run it as a normal HTML file. You will see the following output on the browser window.

Example 2

Create a file "isObject.html" in your Angular project directory and copy-paste the following code snippet.


   
      
      
         AngularJS | angular.isObject()
      
   


   

   Welcome to Tutorials Point

   

   angular.isObject()

         
         Input1:                object = {"Name": "SIMPLY LEARNING"}                
         Is Object? : {{isObject1}}          


         Input2:          null          , Is Object? : {{isObject2}}          


         Input3:          {}          , Is Object? : {{isObject3}}          


         Input4:          ""          , Is Object? : {{isObject4}}          


     
     

Output

To run the above code, just go to your file and run it as a normal HTML file. You will see the following output on the browser window.

Updated on: 2021-10-08T11:09:47+05:30

693 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements