diff options
Diffstat (limited to 'framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch04-02-simple-ng-model2.html')
-rw-r--r-- | framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch04-02-simple-ng-model2.html | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch04-02-simple-ng-model2.html b/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch04-02-simple-ng-model2.html new file mode 100644 index 00000000..d02909f7 --- /dev/null +++ b/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch04-02-simple-ng-model2.html @@ -0,0 +1,40 @@ +<!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"/> +<input type="password" ng-model="ctrl.password"/> +<button ng-click="ctrl.change()">Change values</button> +<button ng-click="ctrl.submit()">Submit</button> + + + + +<script type="text/javascript"> + angular.module('notesApp', []).controller('MainCtrl', [ + function () { + var self = this; + self.change = function () { + self.username = 'changed'; + self.password = 'password'; + }; + + self.submit = function () { + console.log('user clicked submit with ', + self.username, self.password); + }; + } + ]); +</script> + +</body> +</html> |