angular-isFunction

 

angular.isFunction will return true for $scope.isFunction2 and false for $scope.isFunction1 because it is object. Lets see the code snippet:

 
 
 
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Welcome in the AngularJS</title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js"></script> </head> <body ng-app="app"> <div ng-controller="isFunctionController"> IsFunction: {{isFunction1}}<br /> IsFunction: {{isFunction2}} </div> </body> </html> <script> var app = angular.module("app", []); app.controller('isFunctionController', ['$scope', function ($scope) { var obj = [{ name: "Abc", Address: "West" }, { name: "Xyz", Address: "East" }]; var Add = function () { return null; }; $scope.isFunction1 = angular.isFunction(obj); $scope.isFunction2 = angular.isFunction(Add); }]); </script>
Output