If you're looking to incorporate AngularJS into your project, consider the following example:
<!DOCTYPE html>
<html lang="en">
<style>
.red {
color:red;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<body>
<div ng-app="myApp" ng-controller="formCtrl">
<form novalidate>
First Name:<br>
<input ng-change="myFunc()" type="text" ng-model="user.firstName" id="change">
</form>
<p>The input field has changed {{count}} times.</p>
<p>form = {{user}}</p>
<p>master = {{master}}</p>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('formCtrl', function($scope) {
$scope.master = {firstName:"John"};
$scope.reset = function() {
$scope.user = angular.copy($scope.master);
};
$scope.count = 0;
$scope.myFunc = function() {
$scope.count++;
document.getElementById("change").className += " red";
};
$scope.reset();
});
</script>
</body>
</html>
For a live demonstration of this code snippet, access the provided JSFiddle link:https://jsfiddle.net/jve3x6Lk/1/