JSFiddle - React, Tailwind, and code Playground
HTML
<div ng-app="myDirective" ng-controller="x">
<input type="text" ng-model="test" ng-change="updateComplexString()">
<input type="text" ng-model="test2" ng-change="updateComplexString()">
<input type="hidden" ng-model="MyComplexString" custom-validation />
</div>
JavaScript
angular.module('myDirective', [])
.directive('customValidation', function () {
return {
restrict: 'A',
link: function (scope, element, attrs) {
scope.$watch(attrs.ngModel, function (v) {
console.log('value changed, new value is: ' + v);
});
}
};
});
function x($scope) {
$scope.test = "";
$scope.test2 = "";
$scope.updateComplexString = function() {
$scope.MyComplexString = $scope.test + $scope.test2;
}
}