JSFiddle - React, Tailwind, and code Playground
HTML
<div ng-app="Test">
<div ng-controller="TestController">
<div ng-form="TestForm">
<input type="text" ng-model="myData" ng-required="true" />
<button ng-click="overwrite($event)">Click</button>
{{myData}}<br />
Valid: {{TestForm.$valid}}
</div>
</div>
</div>
JavaScript
var app = angular.module('Test', []);
app.controller('TestController', ['$scope', function ($scope) {
$scope.myData = 'Hello';
$scope.overwrite = function ($event) {
$event.preventDefault();
$event.stopPropagation();
$scope.myData = ' ';
};
}]);