I have a scope variable $scope.object = { prop: 12345 }
whose properties I delete with setting them to undefined
.
<button ng-show="object.prop" ng-click="object.prop = undefined"/>
Is there a possibility to delete a properties from within a template and without an additional function in the controller instead of setting their values to undefined
?
use codes below to delete a property from a object
In HTML
<button ng-show="object.prop" ng-click="deleteProperty()" />
In Controller
$scope.deleteProperty = function() {
delete $scope.object.prop;
}