-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathentry.js
More file actions
61 lines (48 loc) · 1.27 KB
/
entry.js
File metadata and controls
61 lines (48 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
'use strict';
require('./scss/reset.scss');
require('./scss/main.scss');
const angular = require('angular');
const cowsay = require('cowsay-browser');
const cowsayApp = angular.module('cowsayApp', []);
cowsayApp.controller('CowsayController', ['$log', CowsayController]);
function CowsayController($log) {
$log.debug('CowsayController');
this.title = 'Cow creator. make it view it and undo it!';
this.history = [];
cowsay.list((err, cowfiles) => {
this.cowfiles = cowfiles;
this.current = this.cowfiles[0];
});
this.update = function(input) {
$log.debug('cowsayCtrl.update()');
return cowsay.say({ text: input || 'moooooooo', f: this.current });
};
this.speak = function(input) {
$log.debug('cowsayCtrl.speak()');
this.spoken = this.update(input);
this.history.push(this.spoken);
};
this.undo = function() {
$log.debug('cowsayCtrl.undo()');
this.history.pop();
this.spoken = this.history.pop() || '';
};
}
cowsayApp.controller('NavController', ['$log', NavController]);
function NavController($log) {
$log.debug('NavController');
this.routes = [
{
name: 'home',
url: '/home'
},
{
name: 'about',
url: '/about-us'
},
{
name: 'contact',
url: '/contact-us'
}
];
}