AngularJS - What is the best way to detect undefined null or empty value at the same time? -
sometimes need check value 3 conditions @ same time, null, undefined or "". due haven´t found method this, coded own , works.
$scope.isnulloremptyorundefined = function (value) { if (value === "" || value === null || typeof value === "undefined") { homecoming true; } }
just wanted know if there improve way accomplish same thing.
thanks much in advance,
guillermo
update
as mentioned in comments it's improve utilize return !value
.
$scope.isvalid = function(value) { homecoming !value }
old , incomplete answer a proper way utilize angular.isdefined()
angularjs
No comments:
Post a Comment