-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathslider.ts
86 lines (65 loc) · 2.71 KB
/
slider.ts
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import { Component,AfterViewInit,OnInit } from '@angular/core';
declare var $;
@Component({
selector: 'my-slider',
templateUrl: './slider.html',
styleUrls:['./slider.css']
})
export class SliderComponent implements OnInit {
title = 'app';
empid:number=10;
name:string='pankaj';
private active="active";
public menus:any;
ngOnInit() {
this.menus = {
"application": "Administration",
"Menu": [{
"id": 3001, "label": "DashBoard Administrationpankaj",
"items": [{ "routerLink": "stockwatch", "id": 300101, "label": "Stock Watch" },
{ "routerLink": "securityinfo", "id": 300102, "label": "Security Info",
"items": [{ "routerLink": "stockwatch", "id": 300101, "label": "Stock Watch ss ss ss sss ss ss ss ss"
,"items":[{ "routerLink": "stockwatch", "id": 300101, "label": "Stock Watch"}]
}]
}]
},
{
"id": 3001, "label": "DashBoard Administrationpankaj",
"items": [{ "routerLink": "stockwatch", "id": 300101, "label": "Stock Watch" },
{ "routerLink": "securityinfo", "id": 300102, "label": "Security Info",
"items": [{ "routerLink": "stockwatch", "id": 300101, "label": "Stock Watch" }]
}]
},
{
"id": 3001, "label": "DashBoard Administrationpankaj",
"items": [{ "routerLink": "stockwatch", "id": 300101, "label": "Stock Watch" },
{ "routerLink": "securityinfo", "id": 300102, "label": "Security Info",
"items": [{ "routerLink": "stockwatch", "id": 300101, "label": "Stock Watch" }]
}]
}
],
};
this.menus.Menu.forEach((ele)=>{
let menuSplit= ele.label.split(" ");
ele["menuSpilt"]=menuSplit
})
console.log( this.menus);
}
toggleMenu(event) {
let atag = $(event.target).closest("a");
if ($(atag).closest("ul").hasClass("sidebar-menu")) {
let currlist = $(atag).parent().index();
if ($("ul.sidebar-menu > li:not(:eq(" + currlist + ")) ul.treeview-menu").hasClass("menu-open")) {
$("ul.sidebar-menu > li:not(:eq(" + currlist + ")) ul.treeview-menu").slideUp().removeClass("menu-open");
$("ul.sidebar-menu > li a").removeClass("text-white");
$("ul.sidebar-menu > li").removeClass("active");
}
$(atag).next('ul.treeview-menu').slideToggle().toggleClass("menu-open");
$(atag).toggleClass("text-white");
$(atag).parent().toggleClass("active");
}
else {
$(atag).next('ul.treeview-menu').slideToggle().addClass("menu-open");
}
}
}