navbar.directive.js
731 Bytes
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
(function() {
'use strict';
angular
.module('dialoga')
.directive('appNavbar', appNavbar);
/** @ngInject */
function appNavbar() {
/** @ngInject */
function NavbarController($log) {
$log.debug('NavbarController');
var vm = this;
vm.scrollTo = function(hash) {
var $el = angular.element('#' + hash);
angular.element('body').animate({scrollTop: $el.offset().top}, 'slow');
};
}
var directive = {
restrict: 'E',
templateUrl: 'app/components/navbar/navbar.html',
scope: {
creationDate: '='
},
controller: NavbarController,
controllerAs: 'vm',
bindToController: true
};
return directive;
}
})();