AngularJs Check if Reference is Array
home
Run
screen_rotation
fullscreen
cloud_download
<!DOCTYPE html> <html lang="en"> <head> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.min.js"></script> <script> var myApp = angular.module("myApp", []); myApp.controller("myController", function($scope) { $scope.html= ''; var myArray = ['1','3']; $scope.checkArray = function() { if(angular.isArray(myArray)){ alert("Is Array"); } } var myArray1 = ''; $scope.checkArray1 = function() { if(angular.isArray(myArray1)){ alert("Is Array"); }else{ alert("Not An Array."); } } }); </script> </head> <body> <div ng-app="myApp"> <div ng-controller="myController"> <button ng-click ="checkArray()">Example1 </button> <br> <button ng-click ="checkArray1()">Example2</button> <br> </div> </div> </body> </html>
<!DOCTYPE html> <html lang="en"> <head> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.min.js"></script> <script> var myApp = angular.module("myApp", []); myApp.controller("myController", function($scope) { $scope.html= ''; var myArray = ['1','3']; $scope.checkArray = function() { if(angular.isArray(myArray)){ alert("Is Array"); } } var myArray1 = ''; $scope.checkArray1 = function() { if(angular.isArray(myArray1)){ alert("Is Array"); }else{ alert("Not An Array."); } } }); </script> </head> <body> <div ng-app="myApp"> <div ng-controller="myController"> <button ng-click ="checkArray()">Example1 </button> <br> <button ng-click ="checkArray1()">Example2</button> <br> </div> </div> </body> </html>
Copyrights@tutorialsplane.com