JSFiddle - React, Tailwind, and code Playground
HTML
<div ng-controller="myCtrl">
<button ng-click="hasProperty('color')">test</button>
<button ng-click="hasProperty('size')">test2</button>
</div>
JavaScript
angular.module("app",[])
.controller("myCtrl",function($scope){
$scope.test = {color:"red"};
$scope.hasProperty = function(prop){
if($scope.test.hasOwnProperty(prop)){
alert("exist");
}else{
alert("non-exist");
}
}
});