angular.isDefined()
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>angular.isDefined</title> </head> <body ng-app="isDefinedExample"> <h1>angular.isDefined</h1> <p> <span>描述:</span><br /> <span>判断参数是否是定义引用</span> </p> <p> <span>使用方法:</span><br /> <span>angular.isDefined(value)</span> </p> <p> <span>参数:</span><br /> <span>value:判断的值</span><br /> </p> <p> <span>返回值:</span><br /> <span>boolean</span> </p> <hr /> <div ng-controller="isDefinedcon"> <!--{{vals}}--> </div> </body> <script src="../../js/angular.1.3.0.js" type="text/javascript" charset="utf-8"></script> <script type="text/javascript"> angular.module('isDefinedExample', []).controller('isDefinedcon', function($scope) { var val = '';
// var val; console.log(angular.isDefined(val)) $scope.vals = angular.isDefined(val); }) </script> </html>