# all files / app/components/navbar/ navbar.directive.js

100% Statements 8/8
100% Branches 0/0
100% Functions 3/3
100% Lines 8/8

    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
    331×

    1×

    1×
    2×

    2×

    1×
    2×

    2×

     (function() {
      'use strict';

      angular
        .module('avalikjoodik')
        .directive('acmeNavbar', acmeNavbar);

      /** @ngInject */
      function acmeNavbar() {
        var directive = {
          restrict: 'E',
          templateUrl: 'app/components/navbar/navbar.html',
          scope: {
              creationDate: '='
          },
          controller: NavbarController,
          controllerAs: 'vm',
          bindToController: true
        };

        return directive;

        /** @ngInject */
        function NavbarController(moment) {
          var vm = this;

          // "vm.creation" is avaible by directive option "bindToController: true"
          vm.relativeDate = moment(vm.creationDate).fromNow();
        }
      }

    })();