This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| angular.module('myApp') | |
| .component('simpleItem', { | |
| template: '<h1>Meeting: {{ $ctrl.getMeetingInfo() }}</h1>', | |
| controller: function() { | |
| this.getMeetingInfo = function() { | |
| return ("Person: " + this.who + ' ' + "At: " + this.where); | |
| } | |
| }, | |
| bindings: { who: '<', where: '<'} | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict'; | |
| angular.module('myApp') | |
| .component('aComponent', { | |
| template: '<div> Hello, {{ $ctrl.localName }}!</div>', | |
| controller: function() { | |
| this.localName = "World"; | |
| } | |
| }); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict'; | |
| angular.module('myApp') | |
| .controller('myController', function() { | |
| var vm = this; | |
| //Info that is needed in the view to properly | |
| //display user information. | |
| vm.viewInfo = { | |
| personName: "", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict'; | |
| angular.module('myApp') | |
| .controller('myController', function() { | |
| var vm = this; | |
| //Info that is needed in the view to properly | |
| //display user information. | |
| vm.viewInfo = { | |
| personName: "", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div ng-app="myModule" | |
| ng-controller="myNgCtrl as vm"> | |
| <div class="my-image-container"> | |
| <img ng-src="{{vm.image}}" | |
| class="my-image" | |
| ng-animate-swap="vm.image"/> | |
| </div> | |
| </div> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .my-image { | |
| transition: 0.75s ease-in-out transform; | |
| &.ng-enter { | |
| transform: translateX(-100%); | |
| } | |
| &.ng-enter-active, | |
| &.ng-leave { | |
| transform: translateX(0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| angular.module('myModule', ['ngAnimate']) | |
| .controller('myNgCtrl', function($interval, $scope) { | |
| var vm = this; | |
| var cycleFn = $interval(grabNextImage, 3000); | |
| var myImages = [ | |
| 'http://placebeyonce.com/450-300', | |
| 'http://placehold.it/450x300', | |
| 'http://placekitten.com/g/450/300' | |
| ]; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "express-app", | |
| "version": "1.0.0", | |
| "description": "An Example Express App for a blog post", | |
| "main": "index.js", | |
| "dependencies": { | |
| "body-parser": "^1.15.0", | |
| "express": "^4.13.4", | |
| "mongoose": "^4.4.5" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var express = require('express'); | |
| var bodyParser = require('body-parser'); | |
| var app = express(); | |
| var router = express.Router(); | |
| var port = process.env.PORT || 9000; | |
| //Middleware that only parses `urlendoded` bodies. | |
| //`extended` allows for an option as to which library | |
| //one wants to use when parsing URL-encoded data. | |
| app.use(bodyParser.urlencoded({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //... | |
| router.get('/hello', function(req, res) { | |
| res.json({ | |
| message: 'Hello, friend!' | |
| }); | |
| }); | |
| router.get('/bye', function(req, res) { | |
| res.json({ | |
| message: 'See yea later!' |