blob: d02909f7f74f4452100de621c2d6dbc66e7cd410 [file] [log] [blame]
Simon Huntd7c203c2014-12-09 16:51:49 -08001<!DOCTYPE html>
2<html ng-app="notesApp">
3<head>
4 <title>Notes App</title>
5 <script src="../../tp/angular.js"></script>
6 <style>
7 span {
8 background-color: #cce;
9 }
10 </style>
11</head>
12<body ng-controller="MainCtrl as ctrl">
13
14<input type="text" ng-model="ctrl.username"/>
15<input type="password" ng-model="ctrl.password"/>
16<button ng-click="ctrl.change()">Change values</button>
17<button ng-click="ctrl.submit()">Submit</button>
18
19
20
21
22<script type="text/javascript">
23 angular.module('notesApp', []).controller('MainCtrl', [
24 function () {
25 var self = this;
26 self.change = function () {
27 self.username = 'changed';
28 self.password = 'password';
29 };
30
31 self.submit = function () {
32 console.log('user clicked submit with ',
33 self.username, self.password);
34 };
35 }
36 ]);
37</script>
38
39</body>
40</html>