JSFiddle - React, Tailwind, and code Playground
by Son Che Dinh
HTML
<body ng-app="myapp">
<div ng-controller="optionsController">
<form name="userForm">
<h5>Nhập tên của bạn:</h5>
<input type="text" name="userName" ng-model-options="{ getterSetter: true }" ng-model="user.name"/><br />
<h5>Bạn đang nhập là:</h5>
<span ng-bind="user.name()"></span>
</form>
</div>
</body>
JavaScript
angular.module('myapp', []).controller('optionsController', ['$scope', function($scope) {
var _name = 'Viblo.asia';
$scope.user = {
name: function(newName) {
return angular.isDefined(newName) ? (_name = newName) : _name;
}
};
}]);