JSFiddle - React, Tailwind, and code Playground
by whitewolf
HTML
<form action="#">
<div ng-controller="test" ng-app="app">
<input ng-value="test" type="hidden" name="a" />
{{test}}
<input type="submit" value="submit"/>
</div>
</form>
JavaScript
var app = angular.module("app",[]);
angular.forEach(['Value'], function(attrName) {
var normalized = 'ng-' + attrName;
var fun= function() {
return {
priority: 99, // it needs to run after the attributes are interpolated
link: function(scope, element, attr) {
attr.$observe(normalized, function(value) {
attr.$set(attrName, value);
if (msie) element.prop(attrName, value);
});
}
};
};
app.directive(normalized ,fun);
});
function test($scope){
$scope.test =1;
$scope.change=function(){
console.log($scope.test);
};
}
app .controller("test",test);