JSFiddle - React, Tailwind, and code Playground
by nicolasmoise
HTML
<div ng-app="myApp" ng-controller="myCtrl">
{{msg}}
<form name="myForm">
<input type="text" name="input" ng-model="msg" required/>
<input type="submit" value="submit" />
</form>
{{myForm.$valid}}
</div>
CSS
.ng-invalid{
background-color:red;
}
JavaScript
angular.module('myApp', [])
.controller('myCtrl', ['$scope', function($scope){
$scope.msg="Hello";
$scope.$watch('msg', function(val){
if(val==='yolo'){
$scope.myForm.$setValidity('$invalid');
}
});
}]);