ch04-01-simple-ng-model.html
563 Bytes
<!DOCTYPE html>
<html ng-app="notesApp">
<head>
<title>Notes App</title>
<script src="../../tp/angular.js"></script>
<style>
span {
background-color: #cce;
}
</style>
</head>
<body ng-controller="MainCtrl as ctrl">
<input type="text" ng-model="ctrl.username"/>
You typed {{ctrl.username}}
<script type="text/javascript">
angular.module('notesApp', []).controller('MainCtrl', [
function () {
var self = this;
self.username = 'nothing';
}
]);
</script>
</body>
</html>