JSFiddle

  • Angular Directive types

    Different ways to put a directive in the html

    //https://docs.angularjs.org/guide/directive#directive-types
    var app = angular.module("superhero", [])
    
    app.directive("myDir", function() {
        return {
            restrict: "EAC",
            template ...
  • goal

    recursive rjavascript

    //Question
    //g()()()('al');
    //output goooal
    //g()()()()()('al');
    //output goooooal
    
    
    var rtn = g()()()()('al');
    console.log(rtn); //gooooal
    
    var rtn2 = g ...
  • Pizza Rough #3 is the latest revision

    Pizza question rough draft

    this.toppings = ['cheese'];
    
    var meat = {
        toppings: ['pepperoni', 
                   'green pepper',
                   'pineapple',
                   'bacon'
                  ],
        size: 'medium',
        eat: function(slice){
            console.log('nom nom ...
  • Toronto Star : Front End Dev Question

    A question that we give to candidates.

    this.toppings = ['cheese'];
    
    var pizza = {
        toppings: [ 
                   'green olives',
                   'green peppers',
                   'tomato'
                  ],
        size: 'large',
        eat: function(slice){
            return false;
        },
        getToppings: function ...
  • Promise Example #3 is the latest revision

    Zenon created this example showing how chaining promises work and deferred custom promises

    angular.module('app', [])
        .controller('main', ['$scope', '$http', '$interval', '$timeout', '$q', function ($scope, $http, $interval, $timeout, $q) {
    
        /*
        $http.get('http://echo ...
  • Peter's Fiddle + Search

    AngularJS 1.2.1, HTML, CSS, JavaScript

    angular.module('app', [ ])
    .controller('main', [ '$scope', '$http', '$interval', function($scope, $http, $interval) {
      $scope.fruits = [ 'apple', 'pear', 'plum' ];
    }])
    .filter('titleCase', function ...
  • Angular Skelleton

    Just some example code

    angular.module('example', [])
        .controller('exampleCtrl', function ($scope) {
            $scope.dynamicCondition = false;
        })
        .directive('testCase', function () {
        return {
            restrict: 'A',
            scope: {
                'condition': '='
            },
            link: function ...
  • Angular Skelleton

    Just some example code

    angular.module('example', [])
        .controller('exampleCtrl', function ($scope) {
            $scope.dynamicCondition = false;
        })
        .directive('testCase', function () {
        return {
            restrict: 'A',
            scope: {
                'condition': '='
            },
            link: function ...
  • Conditional Directive

    action on change

    angular.module('example', [])
        .controller('exampleCtrl', function ($scope) {
            $scope.dynamicCondition = false;
        })
        .directive('testCase', function () {
        return {
            restrict: 'A',
            scope: {
                'condition': '='
            },
            link: function ...
  • Root Scope Example

    Doesn't function here but worked in app

    /* Scrolling directive handler will be utilized in subsequent components  */
    angular.module('mobilefeApp')
    .directive("scroll", function ($window , $location,$rootScope) {
       return function ...