diff options
Diffstat (limited to 'framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples')
34 files changed, 0 insertions, 1469 deletions
diff --git a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch01-01-hello-world-app.html b/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch01-01-hello-world-app.html deleted file mode 100644 index 82cfec6c..00000000 --- a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch01-01-hello-world-app.html +++ /dev/null @@ -1,15 +0,0 @@ -<!DOCTYPE html> -<html> -<body ng-app> - <input type="text" - ng-model="name" - placeholder="Enter your name"> - - <h1>Hello <span ng-bind="name"></span></h1> - <!-- Note alternate syntax for same thig... --> - <h1>Hello {{ name }}</h1> - - <script src="../../tp/angular.js"></script> - -</body> -</html> diff --git a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch02-01-module-example.html b/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch02-01-module-example.html deleted file mode 100644 index 97432e35..00000000 --- a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch02-01-module-example.html +++ /dev/null @@ -1,16 +0,0 @@ -<!DOCTYPE html> -<html ng-app="notesApp"> -<head> - <title>Hello AngularJS</title> - - <script src="../../tp/angular.js"></script> -</head> -<body> - Hello {{1 + 1}}nd time AngularJS - - <script type="text/javascript"> - angular.module('notesApp', []); - </script> - -</body> -</html> diff --git a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch02-02-creating-controller.html b/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch02-02-creating-controller.html deleted file mode 100644 index 566c6dd5..00000000 --- a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch02-02-creating-controller.html +++ /dev/null @@ -1,20 +0,0 @@ -<!DOCTYPE html> -<html ng-app="notesApp"> -<head> - <title>Hello AngularJS</title> - - <script src="../../tp/angular.js"></script> -</head> -<body ng-controller="MainCtrl"> - Hello {{1 + 1}}nd time AngularJS - - <script type="text/javascript"> - angular.module('notesApp', []) - .controller('MainCtrl', [function () { - // controller specific code here - console.log('MainCtrl has been created'); - }]); - </script> - -</body> -</html> diff --git a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch02-03-hello-controller.html b/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch02-03-hello-controller.html deleted file mode 100644 index c206bf8e..00000000 --- a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch02-03-hello-controller.html +++ /dev/null @@ -1,21 +0,0 @@ -<!DOCTYPE html> -<html ng-app="notesApp"> -<head> - <title>Notes App</title> - <script src="../../tp/angular.js"></script> -</head> -<body ng-controller="MainCtrl as ctrl"> - {{ctrl.helloMsg}} AngularJS. - <br/> - {{ctrl.goodbyeMsg}} AngularJS - - <script type="text/javascript"> - angular.module('notesApp', []) - .controller('MainCtrl', [function () { - this.helloMsg = 'Hello '; - var goodbyeMsg = 'Goodbye '; - }]); - </script> - -</body> -</html> diff --git a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch02-04-controller-click-msg.html b/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch02-04-controller-click-msg.html deleted file mode 100644 index 4a4a22ee..00000000 --- a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch02-04-controller-click-msg.html +++ /dev/null @@ -1,26 +0,0 @@ -<!DOCTYPE html> -<html ng-app="notesApp"> -<head> - <title>Notes App</title> - <script src="../../tp/angular.js"></script> -</head> -<body ng-controller="MainCtrl as ctrl"> - {{ctrl.message}} AngularJS. - - <button ng-click="ctrl.changeMessage()"> - Change Message - </button> - - <script type="text/javascript"> - angular.module('notesApp', []) - .controller('MainCtrl', [function () { - var self = this; - self.message = 'Hello'; - self.changeMessage = function () { - self.message = 'Goodbye' - }; - }]); - </script> - -</body> -</html> diff --git a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch02-05-ng-repeat-example-1.html b/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch02-05-ng-repeat-example-1.html deleted file mode 100644 index a262c1b6..00000000 --- a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch02-05-ng-repeat-example-1.html +++ /dev/null @@ -1,29 +0,0 @@ -<!DOCTYPE html> -<html ng-app="notesApp"> -<head> - <title>Notes App</title> - <script src="../../tp/angular.js"></script> -</head> -<body ng-controller="MainCtrl as ctrl"> - - <div ng-repeat="note in ctrl.notes"> - <span class="label"> {{note.label}} </span> - <!--<span class="status" ng-bind="note.done"></span>--> - <span class="status"> {{note.done}} </span> - </div> - - <script type="text/javascript"> - angular.module('notesApp', []) - .controller('MainCtrl', [function () { - var self = this; - self.notes = [ - {id: 1, label: 'First note', done: false}, - {id: 2, label: 'Second note', done: false}, - {id: 3, label: 'Done note', done: true}, - {id: 4, label: 'Last note', done: false} - ] - }]); - </script> - -</body> -</html> diff --git a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch02-06-more-directives.html b/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch02-06-more-directives.html deleted file mode 100644 index 254dd08c..00000000 --- a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch02-06-more-directives.html +++ /dev/null @@ -1,52 +0,0 @@ -<!DOCTYPE html> -<html ng-app="notesApp"> -<head> - <title>Notes App</title> - <style> - .done { - background-color: limegreen; - } - .pending { - background-color: yellow; - } - .assignee { - color: red; - font-weight: bold; - } - </style> - <script src="../../tp/angular.js"></script> -</head> -<body ng-controller="MainCtrl as ctrl"> - - <div ng-repeat="note in ctrl.notes" - ng-class="ctrl.getNoteClass(note.done)"> - <span class="label"> {{note.label}} </span> - <span class="assignee" - ng-show="note.assignee" - ng-bind="note.assignee"> - </span> - </div> - - <script type="text/javascript"> - angular.module('notesApp', []).controller('MainCtrl', [ - function () { - var self = this; - self.notes = [ - {id: 1, label: 'First note', done: false, assignee: 'Simon'}, - {id: 2, label: 'Second note', done: false}, - {id: 3, label: 'Done note', done: true}, - {id: 4, label: 'Last note', done: false, assignee: 'Fred'} - ]; - - self.getNoteClass = function (status) { - return { - done: status, - pending: !status - }; - }; - } - ]); - </script> - -</body> -</html> diff --git a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch02-07-ng-repeat-object.html b/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch02-07-ng-repeat-object.html deleted file mode 100644 index 43de929d..00000000 --- a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch02-07-ng-repeat-object.html +++ /dev/null @@ -1,28 +0,0 @@ -<!DOCTYPE html> -<html ng-app="notesApp"> -<head> - <title>Notes App</title> - <script src="../../tp/angular.js"></script> -</head> -<body ng-controller="MainCtrl as ctrl"> - - <div ng-repeat="(author, note) in ctrl.notes"> - <span class="label"> {{note.label}} </span> - <span class="author" ng-bind="author"></span> - </div> - - <script type="text/javascript"> - angular.module('notesApp', []).controller('MainCtrl', [ - function () { - var self = this; - self.notes = { - simon: { id: 1, label: 'First note', done: false}, - Thomas: { id: 3, label: 'Finished third note', done: true}, - alice: { id: 2, label: 'Second note', done: false} - }; - } - ]); - </script> - -</body> -</html> diff --git a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch02-08-ng-helper-vars.html b/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch02-08-ng-helper-vars.html deleted file mode 100644 index cf872d92..00000000 --- a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch02-08-ng-helper-vars.html +++ /dev/null @@ -1,42 +0,0 @@ -<!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"> - - <div ng-repeat="note in ctrl.notes"> - <div>First element: {{$first}}</div> - <div>Middle element: {{$middle}}</div> - <div>Last element: {{$last}}</div> - <div>Index of element: {{$index}}</div> - <div>At even position: {{$even}}</div> - <div>At odd position: {{$odd}}</div> - - <span class="label"> {{note.label}} </span> - <span class="status"> {{note.done}} </span> - <br/><br/> - </div> - - <script type="text/javascript"> - angular.module('notesApp', []).controller('MainCtrl', [ - function () { - var self = this; - self.notes = [ - {id: 1, label: 'First note', done: false}, - {id: 2, label: 'Second note', done: false}, - {id: 3, label: 'Done note', done: true}, - {id: 4, label: 'Last note', done: false} - ]; - } - ]); - </script> - -</body> -</html> diff --git a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch02-09-ng-repeat-track-id.html b/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch02-09-ng-repeat-track-id.html deleted file mode 100644 index 23ad7dc0..00000000 --- a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch02-09-ng-repeat-track-id.html +++ /dev/null @@ -1,58 +0,0 @@ -<!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"> - - <button ng-click="ctrl.changeNotes()">Change Notes</button> - <br/> - - DOM Elements change at every click - <div ng-repeat="note in ctrl.notes1"> - {{note.$$hashKey}} - <span class="label"> {{note.label}} </span> - <span class="author"> {{note.done}} </span> - </div> - <br/> - - DOM Elements are reused at every click - <div ng-repeat="note in ctrl.notes2 track by note.id"> - {{note.$$hashKey}} - <span class="label"> {{note.label}} </span> - <span class="author"> {{note.done}} </span> - </div> - - <script type="text/javascript"> - angular.module('notesApp', []).controller('MainCtrl', [ - function () { - var self = this; - var notes = [ - {id: 1, label: 'First note', done: false, someRandom: 31431}, - {id: 2, label: 'Second note', done: false}, - {id: 3, label: 'Finished third note', done: true} - ]; - self.notes1 = angular.copy(notes); - self.notes2 = angular.copy(notes); - - self.changeNotes = function () { - notes = [ - {id: 1, label: 'Changed note', done: false, someRandom: 4242}, - {id: 2, label: 'Second note', done: false}, - {id: 3, label: 'Finished third note', done: true} - ]; - self.notes1 = angular.copy(notes); - self.notes2 = angular.copy(notes); - } - } - ]); - </script> - -</body> -</html> diff --git a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch02-10-ng-repeat-across-elements.html b/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch02-10-ng-repeat-across-elements.html deleted file mode 100644 index 06a4fa72..00000000 --- a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch02-10-ng-repeat-across-elements.html +++ /dev/null @@ -1,38 +0,0 @@ -<!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"> - - <table> - <tr ng-repeat-start="note in ctrl.notes"> - <td>{{note.label}}</td> - </tr> - <tr ng-repeat-end> - <td>Done: {{note.done}}</td> - </tr> - </table> - - - <script type="text/javascript"> - angular.module('notesApp', []).controller('MainCtrl', [ - function () { - var self = this; - self.notes = [ - {id: 1, label: 'First note', done: false}, - {id: 2, label: 'Second note', done: false}, - {id: 3, label: 'Finished third note', done: true} - ]; - } - ]); - </script> - -</body> -</html> diff --git a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch04-01-simple-ng-model.html b/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch04-01-simple-ng-model.html deleted file mode 100644 index 5c8a4b13..00000000 --- a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch04-01-simple-ng-model.html +++ /dev/null @@ -1,28 +0,0 @@ -<!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> 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 deleted file mode 100644 index d02909f7..00000000 --- a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch04-02-simple-ng-model2.html +++ /dev/null @@ -1,40 +0,0 @@ -<!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> diff --git a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch04-03-simple-form.html b/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch04-03-simple-form.html deleted file mode 100644 index 54a7ea4b..00000000 --- a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch04-03-simple-form.html +++ /dev/null @@ -1,45 +0,0 @@ -<!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"> - -<!-- - - Note, using a form has the advantage of reacting to RETURN triggering - - the submit, as well as pressing the submit button. - --> -<form ng-submit="ctrl.submit()"> - <input type="text" placeholder="username" ng-model="ctrl.user.username"/> - <input type="password" placeholder="password" ng-model="ctrl.user.password"/> - <input type="submit" value="Submit"/> - <p></p> - <textarea cols="60" rows="5" ng-model="ctrl.user.notes" placeholder="Notes"> - </textarea> - <p> - NOTES: - <div> - {{ctrl.user.notes}} - </div> - </p> -</form> - -<script type="text/javascript"> - angular.module('notesApp', []) - .controller('MainCtrl', [function () { - var self = this; - - self.submit = function () { - console.log('User clicked submit with ', self.user); - }; - }]); -</script> - -</body> -</html> diff --git a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch04-04-two-forms-databinding.html b/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch04-04-two-forms-databinding.html deleted file mode 100644 index 9cb4961c..00000000 --- a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch04-04-two-forms-databinding.html +++ /dev/null @@ -1,44 +0,0 @@ -<!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"> - -<form ng-submit="ctrl.submit1()"> - <input type="text" placeholder="username" ng-model="ctrl.username"/> - <input type="password" placeholder="password" ng-model="ctrl.password"/> - <input type="submit" value="Submit"/> -</form> - -<!-- Better way of structuring the form data --> -<form ng-submit="ctrl.submit2()"> - <input type="text" placeholder="username" ng-model="ctrl.user.username"/> - <input type="password" placeholder="password" ng-model="ctrl.user.password"/> - <input type="submit" value="Submit"/> -</form> - -<script type="text/javascript"> - angular.module('notesApp', []) - .controller('MainCtrl', [function () { - var self = this; - - self.submit1 = function () { - // create user object to send to server - var user = {username: self.username, password: self.password}; - console.log('First submit: ', user); - }; - self.submit2 = function () { - console.log('Second submit: ', self.user); - }; - }]); -</script> - -</body> -</html> diff --git a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch04-05-form-validation.html b/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch04-05-form-validation.html deleted file mode 100644 index 3501adb1..00000000 --- a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch04-05-form-validation.html +++ /dev/null @@ -1,42 +0,0 @@ -<!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"> - -<form ng-submit="ctrl.submit()" name="myForm"> - <input type="text" - placeholder="username" - ng-model="ctrl.user.username" - required - ng-minlength="4"/> - - <input type="password" - placeholder="password" - ng-model="ctrl.user.password" - required/> - - <input type="submit" - value="Submit" - ng-disabled="myForm.$invalid"/> -</form> - -<script type="text/javascript"> - angular.module('notesApp', []) - .controller('MainCtrl', [function () { - var self = this; - self.submit = function () { - console.log('Submit: ', self.user); - }; - }]); -</script> - -</body> -</html> diff --git a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch04-06-form-error-messages.html b/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch04-06-form-error-messages.html deleted file mode 100644 index 46c38c94..00000000 --- a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch04-06-form-error-messages.html +++ /dev/null @@ -1,53 +0,0 @@ -<!DOCTYPE html> -<html ng-app="notesApp"> -<head> - <title>Notes App</title> - <script src="../../tp/angular.js"></script> -</head> -<body ng-controller="MainCtrl as ctrl"> - -<form ng-submit="ctrl.submit()" name="myForm"> - <input type="text" - name="uname" - placeholder="username" - ng-model="ctrl.user.username" - required - ng-minlength="4"/> - <span ng-show="myForm.uname.$error.required"> - This is a required field - </span> - <span ng-show="myForm.uname.$error.minlength"> - Minimum length required is 4 - </span> - <span ng-show="myForm.uname.$invalid"> - This field is invalid - </span> - <br/> - - <input type="password" - name="pwd" - placeholder="password" - ng-model="ctrl.user.password" - required/> - <span ng-show="myForm.pwd.$error.required"> - This is a required field - </span> - <br/> - - <input type="submit" - value="Submit" - ng-disabled="myForm.$invalid"/> -</form> - -<script type="text/javascript"> - angular.module('notesApp', []) - .controller('MainCtrl', [function () { - var self = this; - self.submit = function () { - console.log('Submit: ', self.user); - }; - }]); -</script> - -</body> -</html> diff --git a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch04-07-form-styling.html b/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch04-07-form-styling.html deleted file mode 100644 index 1b6ab867..00000000 --- a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch04-07-form-styling.html +++ /dev/null @@ -1,45 +0,0 @@ -<!DOCTYPE html> -<html ng-app="notesApp"> -<head> - <title>Notes App</title> - <script src="../../tp/angular.js"></script> - <style> - .username.ng-valid { - background-color: greenyellow; - } - .username.ng-dirty.ng-invalid-required { - background-color: hotpink; - } - .username.ng-dirty.ng-invalid-minlength { - background-color: lightpink; - } - </style> -</head> -<body ng-controller="MainCtrl as ctrl"> - -<form ng-submit="ctrl.submit()" name="myForm"> - <input type="text" - class="username" - name="uname" - placeholder="username" - ng-model="ctrl.user.username" - required - ng-minlength="4"/> - - <input type="submit" - value="Submit" - ng-disabled="myForm.$invalid"/> -</form> - -<script type="text/javascript"> - angular.module('notesApp', []) - .controller('MainCtrl', [function () { - var self = this; - self.submit = function () { - console.log('Submit: ', self.user); - }; - }]); -</script> - -</body> -</html> diff --git a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch04-08-nested-forms.html b/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch04-08-nested-forms.html deleted file mode 100644 index c3149195..00000000 --- a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch04-08-nested-forms.html +++ /dev/null @@ -1,63 +0,0 @@ -<!DOCTYPE html> -<html ng-app> -<head> - <title>Notes App</title> - <script src="../../tp/angular.js"></script> -</head> -<!-- no controller in this example --> -<body> - -<form novalidate name="myForm"> - <input type="text" - class="username" - name="uname" - ng-model="ctrl.user.username" - required="" - placeholder="Username" - ng-minlength="4"/> - - <input type="password" - class="password" - name="pad" - ng-model="ctrl.user.password" - required="" - placeholder="Password" - required=""/> - - <p/> - - <ng-form name="profile"> - <input type="text" - name="firstName" - ng-model="ctrl.user.profile.firstName" - placeholder="First Name" - required/> - <input type="text" - name="middleName" - ng-model="ctrl.user.profile.middleName" - placeholder="Middle Name"/> - <input type="text" - name="lastName" - ng-model="ctrl.user.profile.lastName" - placeholder="Last Name" - required/> - - <input type="date" - name="dob" - placeholder="Date of birth" - ng-model="ctrl.user.profile.dob"/> - </ng-form> - - <span ng-show="myForm.profile.$invalid"> - Please fill out the profile information - </span> - - <p/> - - <input type="submit" - value="Submit" - ng-disabled="myForm.$invalid"/> -</form> - -</body> -</html> diff --git a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch04-09-checkbox-example.html b/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch04-09-checkbox-example.html deleted file mode 100644 index fe35af10..00000000 --- a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch04-09-checkbox-example.html +++ /dev/null @@ -1,47 +0,0 @@ -<!DOCTYPE html> -<html ng-app="notesApp"> -<head> - <title>Notes App</title> - <script src="../../tp/angular.js"></script> -</head> -<body ng-controller="MainCtrl as ctrl"> - - <div> - <h2>What are your favorite sports?</h2> - <div ng-repeat="sport in ctrl.sports"> - <label ng-bind="sport.label"></label> - <div> - With binding: - <input type="checkbox" - ng-model="sport.selected" - ng-true-value="'YES'" - ng-false-value="'NO'"/> - </div> - <div> - using ng-checked: - <input type="checkbox" - ng-checked="sport.selected === 'YES'"/> - </div> - <div> - Current state: {{sport.selected}} - </div> - <br/> - </div> - - </div> - - <script type="text/javascript"> - angular.module('notesApp', []) - .controller('MainCtrl', [function () { - var self = this; - self.sports = [ - {label: 'Basketball', selected: 'YES'}, - {label: 'Cricket', selected: 'NO'}, - {label: 'Soccer', selected: 'NO'}, - {label: 'Swimming', selected: 'YES'} - ]; - }]); - </script> - -</body> -</html> diff --git a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch04-10-radio-buttons.html b/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch04-10-radio-buttons.html deleted file mode 100644 index 2a2cb83d..00000000 --- a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch04-10-radio-buttons.html +++ /dev/null @@ -1,63 +0,0 @@ -<!DOCTYPE html> -<html ng-app="notesApp"> -<head> - <title>Notes App</title> - <script src="../../tp/angular.js"></script> -</head> -<body ng-controller="MainCtrl as ctrl"> - - <div> - <h2>Radio Buttons</h2> - <div ng-init="user.gender = 'female'"> - <input type="radio" - name="gender" - ng-model="user.gender" - value="male"/>Male - <input type="radio" - name="gender" - ng-model="user.gender" - value="female"/>Female - </div> - </div> - - <div> - <h2>Radio Buttons two</h2> - <div ng-init="user.gender2 = 'male'; otherGender = 'Other'"> - <input type="radio" - name="gender2" - ng-model="user.gender2" - value="male"/>Male - <input type="radio" - name="gender2" - ng-model="user.gender2" - value="female"/>Female - <input type="radio" - name="gender2" - ng-model="user.gender2" - ng-value="otherGender"/>{{otherGender}} - </div> - </div> - - <div> - <h2>Radio Buttons three</h2> - <div ng-repeat="ch in ctrl.choices"> - <input type="radio" - name="choice" - ng-model="user.choice" - ng-value="ch"/>{{ch}} - - </div> - </div> - - - <script type="text/javascript"> - angular.module('notesApp', []) - .controller('MainCtrl', [function () { - var self = this; - - self.choices = ['foo', 'bar', 'baz', 'zoo', 'goo']; - }]); - </script> - -</body> -</html> diff --git a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch04-11-select-example.html b/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch04-11-select-example.html deleted file mode 100644 index a8cda33c..00000000 --- a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch04-11-select-example.html +++ /dev/null @@ -1,41 +0,0 @@ -<!DOCTYPE html> -<html ng-app="notesApp"> -<head> - <title>Notes App</title> - <script src="../../tp/angular.js"></script> -</head> -<body ng-controller="MainCtrl as ctrl"> - - <div> - <select ng-model="ctrl.selectedCountryId" - ng-options="c.id as c.label for c in ctrl.countries"> - </select> - Selected Country ID: {{ctrl.selectedCountryId}} - </div> - - <div> - <select ng-model="ctrl.selectedCountry" - ng-options="c.label for c in ctrl.countries track by c.id"> - </select> - Selected Country: {{ctrl.selectedCountry}} - </div> - - <script type="text/javascript"> - angular.module('notesApp', []) - .controller('MainCtrl', [function () { - var self = this; - - self.countries = [ - {label: 'UK', id: 1}, - {label: 'USA', id: 2}, - {label: 'France', id: 3}, - {label: 'Italy', id: 4} - ]; - var first = self.countries[0]; - self.selectedCountryId = first.id; - self.selectedCountry = first; - }]); - </script> - -</body> -</html> diff --git a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch05-01-need-for-service-app.js b/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch05-01-need-for-service-app.js deleted file mode 100644 index 4e25b0b1..00000000 --- a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch05-01-need-for-service-app.js +++ /dev/null @@ -1,34 +0,0 @@ -// ch05-01-need-for-service-app.js - -angular.module('notesApp', []) - .controller('MainCtrl', [function () { - var self = this; - self.tab = 'first'; - self.open = function (tab) { - self.tab = tab; - } - }]) - .controller('SubCtrl', [function () { - var self = this; - self.list = [ - {id: 0, label: 'Item 0'}, - {id: 1, label: 'Item 1'} - ]; - - self.add = function () { - var n = self.list.length; - self.list.push({ - id: n, - label: 'Item ' + n - }); - } - }]); - -/* - NOTE: When we use controllers, they are instances that get created and - destroyed as we navigate across the application. Any state they - hold is temporary at best, and cannot be communicated to other - controllers. - - That's why we'd use "services" instead. - */ diff --git a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch05-01-need-for-service.html b/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch05-01-need-for-service.html deleted file mode 100644 index 21d17e4c..00000000 --- a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch05-01-need-for-service.html +++ /dev/null @@ -1,41 +0,0 @@ -<!DOCTYPE html> -<html ng-app="notesApp"> -<head> - <title>Notes App</title> - <script src="../../tp/angular.js"></script> - <script src="ch05-01-need-for-service-app.js"></script> -</head> -<body ng-controller="MainCtrl as mainCtrl"> - - <h1> Hello Controllers! </h1> - <button ng-click="mainCtrl.open('first')">Open First</button> - <button ng-click="mainCtrl.open('second')">Open Second</button> - - <div ng-switch on="mainCtrl.tab"> - - <div ng-switch-when="first"> - <div ng-controller="SubCtrl as ctrl"> - <h3>First Tab</h3> - <button ng-click="ctrl.add()">Add more items</button> - <ul> - <li ng-repeat="item in ctrl.list"> - <span ng-bind="item.label"></span> - </li> - </ul> - </div> - </div> - - <div ng-switch-when="second"> - <div ng-controller="SubCtrl as ctrl"> - <h3>Second Tab</h3> - <button ng-click="ctrl.add()">Add more items</button> - <ul> - <li ng-repeat="item in ctrl.list"> - <span ng-bind="item.label"></span> - </li> - </ul> - </div> - </div> - </div> -</body> -</html> diff --git a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch05-02-log-example.html b/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch05-02-log-example.html deleted file mode 100644 index d516440d..00000000 --- a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch05-02-log-example.html +++ /dev/null @@ -1,22 +0,0 @@ -<!DOCTYPE html> -<html ng-app="notesApp"> -<head> - <title>Notes App</title> - <script src="../../tp/angular.js"></script> -</head> -<body ng-controller="MainCtrl as mainCtrl"> - - <h1> Hello Services! </h1> - <button ng-click="mainCtrl.logStuff()">Log something</button> - - <script type="text/javascript"> - angular.module('notesApp', []) - .controller('MainCtrl', ['$log', function ($log) { - var self = this; - self.logStuff = function () { - $log.log('The button was pressed'); - }; - }]); - </script> -</body> -</html> diff --git a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch05-03-simple-angular-service.html b/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch05-03-simple-angular-service.html deleted file mode 100644 index 74f2a8e8..00000000 --- a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch05-03-simple-angular-service.html +++ /dev/null @@ -1,43 +0,0 @@ -<!DOCTYPE html> -<html ng-app="notesApp"> -<head> - <title>Notes App</title> - <script src="../../tp/angular.js"></script> - <script src="ch05-03-simple-angular-service.js"></script> -</head> -<body ng-controller="MainCtrl as mainCtrl"> - - <h1> Hello Controllers! </h1> - - <button ng-click="mainCtrl.open('first')"> Open First </button> - <button ng-click="mainCtrl.open('second')"> Open Second </button> - - <div ng-switch on="mainCtrl.tab"> - - <div ng-switch-when="first"> - <div ng-controller="SubCtrl as ctrl"> - <h3>First Tab</h3> - <button ng-click="ctrl.add()">Add item</button> - <ul> - <li ng-repeat="item in ctrl.list()"> - <span ng-bind="item.label"></span> - </li> - </ul> - </div> - </div> - - <div ng-switch-when="second"> - <div ng-controller="SubCtrl as ctrl"> - <h3>Second Tab</h3> - <button ng-click="ctrl.add()">Add item</button> - <ul> - <li ng-repeat="item in ctrl.list()"> - <span ng-bind="item.label"></span> - </li> - </ul> - </div> - </div> - </div> - -</body> -</html> diff --git a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch05-03-simple-angular-service.js b/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch05-03-simple-angular-service.js deleted file mode 100644 index 25786bed..00000000 --- a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch05-03-simple-angular-service.js +++ /dev/null @@ -1,115 +0,0 @@ -// ch05-03-simple-angular-service.js - -// this example shows three different ways of defining our own "service"... - -// use 'factory()' for functions/plain objects API -// use 'service()' for JS class object API -// use 'provider()' for configurable service API - - -// this is a service definition -function ItemServiceTwo() { - var items = [ - {id: 0, label: 'Item 0'}, - {id: 1, label: 'Item 1'} - ]; - this.list = function () { - return items; - }; - this.add = function (item) { - items.push(item); - }; -} - -// this is a provider definition -function ItemServiceThree(optItems) { - var items = optItems || []; - - this.list = function () { - return items; - }; - this.add = function (item) { - items.push(item); - } -} - -angular.module('notesApp', []) - - // [provider] define item service as configurable provider - .provider('ItemServiceThree', function () { - var haveDefaultItems = true; - - this.disableDefaultItems = function () { - haveDefaultItems = false; - }; - - // this function gets our dependencies.. - this.$get = [function () { - var optItems = []; - if (haveDefaultItems) { - optItems = [ - {id: 0, label: 'Item 0'}, - {id: 1, label: 'Item 1'} - ]; - } - return new ItemServiceThree(optItems); - }]; - }) - - // [provider] define configuration for provider - .config(['ItemServiceThreeProvider', function (ItemServiceThreeProvider) { - // to see how the provider can change configuration - // change the value of shouldHaveDefaults to true and - // try running the example - var shouldHaveDefaults = false; - - // get configuration from server. - // set shouldHaveDefaults somehow - // assume it magically changes for now - if (!shouldHaveDefaults) { - ItemServiceThreeProvider.disableDefaultItems(); - } - }]) - - // [service] define item service as a JS class - .service('ItemServiceTwo', [ItemServiceTwo]) - - // [factory] define item service factory - .factory('ItemService', [function () { - var items = [ - {id: 0, label: 'Item 0'}, - {id: 1, label: 'Item 1'} - ]; - return { - list: function () { - return items; - }, - add: function (item) { - items.push(item); - } - }; - }]) - - // ====================================================================== - // define controllers... - .controller('MainCtrl', [function () { - var self = this; - self.tab = 'first'; - self.open = function (tab) { - self.tab = tab; - }; - }]) - - .controller('SubCtrl', ['ItemService', function (ItemService) { - var self = this; - self.list = function () { - return ItemService.list(); - }; - self.add = function () { - var n = self.list().length; - ItemService.add({ - id: n, - label: 'Item ' + n - }); - }; - }]); diff --git a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch08-01-filter-example.html b/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch08-01-filter-example.html deleted file mode 100644 index 105209ca..00000000 --- a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch08-01-filter-example.html +++ /dev/null @@ -1,48 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <title>Filters in Action</title> - <script src="../../tp/angular.js"></script> -</head> -<body ng-app="filtersApp"> - - <div ng-controller="FilterCtrl as ctrl"> - <div> - Amount as a number: {{ctrl.amount | number}} - </div> - <div> - Total cost as a currency: {{ctrl.totalCost | currency}} - </div> - <div> - Total cost in GBP: {{ctrl.totalCost | currency:'GBP '}} - </div> - <div> - Shout: {{ctrl.name | uppercase}} - </div> - <div> - Whisper: {{ctrl.name | lowercase}} - </div> - <div> - Start time: {{ctrl.startTime | date:'medium'}} - </div> - <div> - as JSON: {{ctrl.struct | json}} - </div> - </div> - - <script type="text/javascript"> - angular.module('filtersApp', []) - .controller('FilterCtrl', [function () { - var self = this; - self.amount = 1024; - self.totalCost = 4906; - self.name = 'Onos Rocks!'; - self.startTime = new Date().getTime(); - self.struct = { - foo: 'bar', - baz: 3.1415 - }; - }]); - </script> -</body> -</html> diff --git a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch08-02-filter-number-string.html b/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch08-02-filter-number-string.html deleted file mode 100644 index 46e9c4d7..00000000 --- a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch08-02-filter-number-string.html +++ /dev/null @@ -1,83 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <title>Filters in Action</title> - <script src="../../tp/angular.js"></script> -</head> -<body ng-app="filtersApp"> - - <ul ng-controller="FilterCtrl as ctrl"> - <li> - Amount - {{ctrl.amount}} - </li> - <li> - Amount - Default Currency: {{ctrl.amount | currency}} - </li> - <li> - <!-- Using English pound sign --> - Amount - GBP Currency: {{ctrl.amount | currency:'£'}} - </li> - <li> - Amount - Number: {{ctrl.amount | number }} - </li> - <li> - Amount - Number (4 decimals): {{ctrl.amount | number:4}} - </li> - <li> - Amount - Yummy π = {{ctrl.pi | number:4 }} - </li> - - <li> - Name - no filters: {{ctrl.name}} - </li> - <li> - Name - lowercase: {{ctrl.name | lowercase}} - </li> - <li> - Name - uppercase: {{ctrl.name | uppercase}} - </li> - <li> - Name - prefix: {{ctrl.name | limitTo:4}} - </li> - - <li> - JSON filter: {{ctrl.struct | json}} - </li> - - <li> - Timestamp: {{ctrl.startTime}} - </li> - <li> - Default Date filter: {{ctrl.startTime | date}} - </li> - <li> - Medium Date filter: {{ctrl.startTime | date:'medium'}} - </li> - <li> - Long Date filter: {{ctrl.startTime | date:'longDate'}} - </li> - <li> - Custom Date filter: {{ctrl.startTime | date:'M/dd, yyyy'}} - </li> - <li> - Custom Time filter: {{ctrl.startTime | date:'h:m a'}} - </li> - </ul> - - <script type="text/javascript"> - angular.module('filtersApp', []) - .controller('FilterCtrl', [function () { - var self = this; - self.amount = 1024; - self.totalCost = 4906; - self.name = 'Onos Rocks!'; - self.startTime = new Date().getTime(); - self.struct = { - foo: 'bar', - baz: 3.1415 - }; - self.pi = Math.PI; - }]); - </script> -</body> -</html> diff --git a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch08-03-filter-arrays.html b/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch08-03-filter-arrays.html deleted file mode 100644 index a9ce3cae..00000000 --- a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch08-03-filter-arrays.html +++ /dev/null @@ -1,86 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <title>Filters in Action</title> - <script src="../../tp/angular.js"></script> -</head> -<body ng-app="filtersApp"> - - <div ng-controller="FilterCtrl as ctrl"> - - <table> - <tr> - <td> - <button ng-click="ctrl.currentFilter = 'string'"> - Filter with string - </button> - </td> - <td> - Filter Text - <input type="text" - ng-model="ctrl.filterOptions['string']"/> - </td> - </tr> - <tr> - <td> - <button ng-click="ctrl.currentFilter = 'object'"> - Filter with object - </button> - </td> - <td> - Show Done or Not Done - <input type="checkbox" - ng-model="ctrl.filterOptions['object'].done"/> - </td> - </tr> - <tr> - <td> - <button ng-click="ctrl.currentFilter = 'function'"> - Filter with function - </button> - </td> - </tr> - </table> - <ul> - <li ng-repeat="note in ctrl.notes | - filter:ctrl.filterOptions[ctrl.currentFilter] | - orderBy:ctrl.sortOrder | - limitTo:5"> - {{note.label}} - {{note.type}} - {{note.done}} - </li> - </ul> - </div> - - - <script type="text/javascript"> - angular.module('filtersApp', []) - .controller('FilterCtrl', [function () { - var self = this; - - self.notes = [ - {label: 'FC Todo', type: 'chore', done: false}, - {label: 'FT Todo', type: 'task', done: false}, - {label: 'FF Todo', type: 'fun', done: true}, - {label: 'SC Todo', type: 'chore', done: false}, - {label: 'ST Todo', type: 'task', done: true}, - {label: 'SF Todo', type: 'fun', done: true}, - {label: 'TC Todo', type: 'chore', done: false}, - {label: 'TT Todo', type: 'task', done: false}, - {label: 'TF Todo', type: 'fun', done: false} - ]; - - self.sortOrder = ['+type', '-label']; - - self.filterOptions = { - 'string': '', - 'object': {done: false, label: 'F'}, - 'function': function (note) { - return note.type === 'task' && note.done === false; - } - }; - - self.currentFilter = 'string'; - }]); - </script> -</body> -</html> diff --git a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch08-04-custom-filters.html b/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch08-04-custom-filters.html deleted file mode 100644 index f39991d9..00000000 --- a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch08-04-custom-filters.html +++ /dev/null @@ -1,61 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <title>Custom Filters in Action</title> - <script src="../../tp/angular.js"></script> -</head> -<body ng-app="filtersApp"> - - <div ng-controller="FilterCtrl as ctrl"> - <div> - Start time (Timestamp): {{ctrl.startTime}} - </div> - <div> - Start time (Time): {{ctrl.startTime | date:'h:m a'}} - </div> - <div> - Start time (Our filter): {{ctrl.startTime | timeAgo}} - </div> - <div> - Start time (Our filter 2): {{ctrl.startTime | timeAgo:true}} - </div> - <div> - Some time ago (Computed): {{ctrl.someTimeAgo | date:'h:m a'}} - </div> - <div> - Some time ago (Our filter): {{ctrl.someTimeAgo | timeAgo}} - </div> - </div> - - <script type="text/javascript"> - angular.module('filtersApp', []) - .controller('FilterCtrl', [function () { - var self = this; - self.startTime = new Date().getTime(); - self.someTimeAgo = self.startTime - (1000*3600*4); - }]) - .filter('timeAgo', [function () { - var _m = 1000 * 60, - _h = _m * 60, - _d = _h * 24, - _mon = _d * 30; - - return function (ts, ignoreSecs) { - var now = new Date().getTime(), - diff = now - ts; - if (diff < _m && !ignoreSecs) { - return 'seconds ago'; - } else if (diff < _h) { - return 'minutes ago'; - } else if (diff < _d) { - return 'hours ago'; - } else if (diff < _mon) { - return 'days ago'; - } else { - return 'months ago'; - } - } - }]); - </script> -</body> -</html> diff --git a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch10-01-simple-routing.html b/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch10-01-simple-routing.html deleted file mode 100644 index 29614127..00000000 --- a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/ch10-01-simple-routing.html +++ /dev/null @@ -1,36 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <title>Simple Routing</title> - <script src="../../tp/angular.js"></script> - <script src="../../tp/angular-route.js"></script> -</head> -<body ng-app="routingApp"> - - <h2>Angular Routing</h2> - - <ul> - <li><a href="#/">Default Route</a></li> - <li><a href="#/second">Second Route</a></li> - <li><a href="#/asdfertdfghsdfg">Non-existent Route</a></li> - </ul> - - <div ng-view></div> - - <script type="text/javascript"> - angular.module('routingApp', ['ngRoute']) - .config(['$routeProvider', function ($routeProvider) { - $routeProvider - .when('/', { - template: '<h5>This is the default route</h5>' - }) - .when('/second', { - template: '<h5>This is the second route</h5>' - }) - .otherwise({ - redirectTo: '/' - }); - }]); - </script> -</body> -</html> diff --git a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/js/ch03-controller.js b/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/js/ch03-controller.js deleted file mode 100644 index 92d3b0c0..00000000 --- a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/js/ch03-controller.js +++ /dev/null @@ -1,17 +0,0 @@ -// Simple controller - -angular.module('notesApp', []) - .controller('ListCtrl', [function () { - var self = this; - self.items = [ - {id: 1, label: 'First', done: true}, - {id: 2, label: 'Second', done: false} - ]; - - self.getDoneClass = function (item) { - return { - finished: item.done, - unfinished: !item.done - }; - }; - }]); diff --git a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/js/ch09-01-time-ago.js b/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/js/ch09-01-time-ago.js deleted file mode 100644 index 1a8b7f1c..00000000 --- a/framework/src/onos/web/gui/src/main/webapp/_sdh/ng-examples/js/ch09-01-time-ago.js +++ /dev/null @@ -1,27 +0,0 @@ -// ch09-01-time-ago.js - -angular.module('filterApp', []) - .filter('timeAgo', [function () { - var _m = 1000 * 60, - _h = _m * 60, - _d = _h * 24, - _mon = _d * 30; - - return function (ts, ignoreSecs) { - var showSecs = !ignoreSecs, - now = new Date().getTime(), - diff = now - ts; - - if (diff < _m && showSecs) { - return 'seconds ago'; - } else if (diff < _h) { - return 'minutes ago'; - } else if (diff < _d) { - return 'hours ago'; - } else if (diff < _mon) { - return 'days ago'; - } else { - return 'months ago'; - } - } - }]); |