<!DOCTYPE html>
<html ng-app="myApp">
<head>
<meta charset="UTF-8">
<title>Hello World AngularJS</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular.min.js"></script>
<script src="controller.js"></script>
</head>
<body ng-controller="myCtrl">
<input type="text" ng-model="myText" ng-model-options="{getterSetter: true}">
{{text}}
</body>
</html>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
var myText = "HELLO";
$scope.myText = function(newText) {
if(angular.isDefined(newText)) {
myText = newText.toUpperCase();
return myText;
} else {
return myText;
}
};
});