前端之家收集整理的这篇文章主要介绍了
angularjs数据类型判断及比较,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
<!DOCTYPE html>
<html>
<head>
<Meta charset="UTF-8">
<title></title>
<script type="text/javascript" src="js/angular.min.js" ></script>
</head>
<body>
<div id="" ng-app="hd" ng-controller="ctrl">
</div>
<script> var m=angular.module("hd",[]); m.controller("ctrl",["$scope",function($scope){ var variable; console.log(angular.isUndefined(variable)) var numParam=90; console.log(angular.isNumber(numParam)); var strParam="str is string"; console.log(angular.isString(strParam)); var objParam={}; console.log(angular.isObject(objParam)); var script=document.getElementsByTagName('script').item(0); console.log(angular.isElement(script)); obj1={name:"张三"}; obj2={name:"张三"} console.log(angular.equals(obj1,obj2)); }]); </script>
</body>
</html>
原文链接:https://www.f2er.com/angularjs/148338.html