{{ cowsayCtrl.title }}
+
+ {{ cowsayCtrl.update(cowsayCtrl.text) }}
+
+
+
+ diff --git a/lab-nathan/.babelrc b/lab-nathan/.babelrc new file mode 100644 index 0000000..af0f0c3 --- /dev/null +++ b/lab-nathan/.babelrc @@ -0,0 +1,3 @@ +{ + "presets": ["es2015"] +} \ No newline at end of file diff --git a/lab-nathan/.gitignore b/lab-nathan/.gitignore new file mode 100644 index 0000000..b512c09 --- /dev/null +++ b/lab-nathan/.gitignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/lab-nathan/app/entry.js b/lab-nathan/app/entry.js new file mode 100644 index 0000000..987b72e --- /dev/null +++ b/lab-nathan/app/entry.js @@ -0,0 +1,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 = 'Welcome to Cowville!'; + this.history = []; + + cowsay.list((err, cowfiles) => { + this.cowfiles = cowfiles; + this.current = this.cowfiles[0]; + }); + + this.update = function(input) { + $log.debug('coswsayCtrl.update()'); + return cowsay.say({ text: input || 'moooooo', 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' + } + ]; +} \ No newline at end of file diff --git a/lab-nathan/app/index.html b/lab-nathan/app/index.html new file mode 100644 index 0000000..8767133 --- /dev/null +++ b/lab-nathan/app/index.html @@ -0,0 +1,48 @@ + + +
+
+ {{ cowsayCtrl.update(cowsayCtrl.text) }}
+
+
+
+