Open In App

AngularJS angular.isObject() Function

Last Updated : 05 Sep, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

The angular.isobject() Function in AngularJS is used to determine if the parameter inside isobject function is an object or not. It returns true if the reference is an object or else false. 

Syntax:

angular.isobject(value);

Parameter:

  • value: This parameter value validates whether the entered value is an object or not.

Return Value: It returns true if the value passed is an object else false.

Example 1: This example describes the angular.isObject() Function in AngularJS.

HTML




<!DOCTYPE html>
<html>
  
<head>
    <script src=
"//ajax.googleapis.com/ajax/libs/angularjs/1.3.2/angular.min.js">
    </script>
    <title>angular.isObject()</title>
</head>
  
<body ng-app="app" style="text-align:center">
    <h1 style="color:green">GeeksforGeeks</h1>
    <h2>angular.isObject()</h2>
    <div ng-controller="geek"
       <b>Input1: </b
       <span>
            <code>
                obj1 = {"Name": "Binary search"}
            </code>
        </span>
        <br>
        <b>isObject: </b>{{isObject1}}
        <br /><br><br
        <b>Input2: </b
        <code>
            "geeksforgeeks"
        </code>
        <br
        <b>isObject:</b> {{isObject2}} 
    </div>
    <script>
        var app = angular.module("app", []);
        app.controller('geek', ['$scope', function($scope) {
            var obj1 = {
                "Name": "Binary search"
            };
            var obj2 = "geeksforgeeks";
            $scope.isObject1 = angular.isObject(obj1);
            $scope.isObject2 = angular.isObject(obj2);
        }]);
    </script>
</body>
</html>


Output:

isobject

Example 2: This example describes the angular.isObject() Function in AngularJS, where both the input values are validated.

HTML




<!DOCTYPE html>
<html>
  
<head>
    <title>angular.isObject()</title>
    <script src=
    </script>
</head>
  
<body ng-app="app" style="text-align: center">
    <h1 style="color: green">GeeksforGeeks</h1>
    <h2>angular.isObject()</h2>
    <div ng-controller="geek">
        <b>Input 1: </b>
        <span>
            <code> obj1 ={{val1}} </code>
        </span>
        <br /><br />
        <b> isObject: </b>{{isObject2}} 
        <br /><br />
        <b>Input 2:</b>
        <span>
            <code> obj2 = null; </code>
        </span>
        <br /><br />
        <b>isObject: </b> {{isObject1}}
    </div>
  
    <script>
        var app = angular.module('app', []);
        app.controller('geek', [
            '$scope',
            function ($scope) {
                var val2 = null;
                $scope.val1 = [
                    { Name: 'Merge Sort' },
                    { Name: 'Quick Sort' },
                    { Name: 'Selection Sort' },
                ];
  
                $scope.isObject1 =
                    angular.isObject($scope.val2) == true ? 'true.' : 'false';
  
                $scope.isObject2 =
                    angular.isObject($scope.val1) == true ? 'true' : 'false';
            },
        ]);
    </script>
</body>
</html>


Output:

 



Previous Article
Next Article

Similar Reads

Underscore.js _.isObject() Function
Underscore.js_.isObject() function is used to check whether the given object is an object or not. It returns a Boolean value True if the given object element is an object and returns False otherwise. JavaScript functions and arrays are objects, while the strings and numbers are not objects. Syntax: _.isObject( value );Parameters:object: This parame
1 min read
Lodash _.isObject() Method
Lodash _.isObject() method is used to find whether the given value is an object or not. It returns a Boolean value True if the given value parameter is an object and returns False otherwise. The object can be of type arrays, functions, regexes, new Number(0), and new String("). Syntax:_.isObject(value);Parameter:value(*) parameter holds the value t
1 min read
AngularJS angular.isUndefined() Function
The angular.isUndefined() function in AngularJS is used to determine the value inside isUndefined function is undefined or not. It returns true if the reference is undefined otherwise returns false. Syntax: angular.isUndefined( value ) Parameter value: value: It is used to reference the value to check whether the value is defined or undefined.Retur
2 min read
AngularJS angular.isNumber() Function
The angular.isNumber() function in AngularJS is used to determine the parameter inside isNumber function is a number or not. It returns true if the reference is a number otherwise returns false. Syntax: angular.isNumber( value );Parameter value: value: It determines whether the entered value is a number or not.Return Value: It returns a boolean val
2 min read
AngularJS | angular.isString() Function
The angular.isString() function in AngularJS is used to determine the parameter inside isString function is a string or not. It returns true if the reference is a string otherwise returns false. Syntax: angular.isString( value ) Return Value: It returns true if the value passed is a string otherwise return false. Example: This example uses angular.
1 min read
AngularJS angular.isDefined() Function
The angular.isDefined() function in AngularJS is used to determine the value inside isDefined function is defined or not. It returns true if the reference is defined otherwise returns false. Syntax: angular.isDefined( value );Parameter value: value: This parameter is a reference to check whether the entered value is defined or not.Return Value: It
2 min read
AngularJS angular.isDate() Function
The angular.isDate() function in AngularJS is used to determine whether the value of the date is valid or not. It returns true if the reference is a date else false. Syntax: angular.isDate( value );Parameters: This function accepts a single parameter: value: It stores the data object. Return Value: It returns true if the value passed is a date else
2 min read
AngularJS angular.toJson() Function
The angular.toJson() Function in AngularJS is used to serialize the javascript object into a JSON - formatted string. It takes the javascript object and returns a JSON string. The angular.toJson() function in AngularJS is capable of handling circular references in JavaScript objects. Circular references occur when an object refers to itself or when
2 min read
AngularJS angular.element() Function
The angular.element() Function in AngularJS is used to initialize DOM element or HTML string as an jQuery element. If jQuery is available angular.element can be either used as an alias for the jQuery function or it can be used as a function to wrap the element or string in Angular's jqlite. Syntax: angular.element(element)Parameter value: element:
2 min read
AngularJS angular.isFunction() Function
The angular.isFunction() Function in AngularJS is used to determine if the parameter inside isFunction function is a function or not. It returns true if the reference is a function else false. Syntax: angular.isFunction(value);Parameter: value: This parameter specifies whether the passed value is a function or not.Return Value: It returns true if t
2 min read