-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy pathnavbar.component.js
42 lines (38 loc) · 1.11 KB
/
navbar.component.js
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
38
39
40
41
42
'use strict';
export class NavbarComponent {
menu = [{
'title': 'Home',
<% if (filters.uirouter) { %>'state': 'main'<% } else { %>'link': '/'<% } %>
}];
<%_ if(!filters.uirouter) { -%>
$location;
<%_ } -%>
<%_ if (filters.auth) { -%>
isLoggedIn: Function;
isAdmin: Function;
getCurrentUser: Function;
<%_ } -%>
isCollapsed = true;
<%_ if(filters.ngroute || filters.auth) { _%>
constructor(<% if(!filters.uirouter) { %>$location<% } if(!filters.uirouter && filters.auth) { %>, <% } if (filters.auth) { %>Auth<% } %>) {
'ngInject';
<%_ if(!filters.uirouter) { _%>
this.$location = $location;
<%_ } _%>
<%_ if (filters.auth) { _%>
this.isLoggedIn = Auth.isLoggedInSync;
this.isAdmin = Auth.isAdminSync;
this.getCurrentUser = Auth.getCurrentUserSync;
<%_ } _%>
}<% } %>
<%_ if(!filters.uirouter) { _%>
isActive(route) {
return route === this.$location.path();
}<% } %>
}
export default angular.module('directives.navbar', [])
.component('navbar', {
template: require('./navbar.<%= templateExt %>'),
controller: NavbarComponent
})
.name;