blob: 3501adb139536e7beec9567dc07c8e72f63228df [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<form ng-submit="ctrl.submit()" name="myForm">
15 <input type="text"
16 placeholder="username"
17 ng-model="ctrl.user.username"
18 required
19 ng-minlength="4"/>
20
21 <input type="password"
22 placeholder="password"
23 ng-model="ctrl.user.password"
24 required/>
25
26 <input type="submit"
27 value="Submit"
28 ng-disabled="myForm.$invalid"/>
29</form>
30
31<script type="text/javascript">
32 angular.module('notesApp', [])
33 .controller('MainCtrl', [function () {
34 var self = this;
35 self.submit = function () {
36 console.log('Submit: ', self.user);
37 };
38 }]);
39</script>
40
41</body>
42</html>