Skip to content

Commit d50563b

Browse files
committed
fix bootstrap navbar
1 parent 0c8cd4c commit d50563b

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

angular/src/app/app.component.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component } from '@angular/core';
1+
import { Component, OnInit } from '@angular/core';
22
import { CommonModule } from '@angular/common';
33
import { RouterLink, RouterOutlet } from '@angular/router';
44

@@ -9,9 +9,21 @@ import { RouterLink, RouterOutlet } from '@angular/router';
99
templateUrl: './app.component.html',
1010
styleUrls: ['./app.component.css']
1111
})
12-
export class AppComponent {
12+
13+
export class AppComponent implements OnInit {
1314
title = 'angular-routing';
1415
footerUrl = 'https://www.ganatan.com';
1516
footerLink = 'www.ganatan.com';
16-
}
17+
ngOnInit(): void {
18+
19+
const navMain = document.getElementById('navbarCollapse');
20+
if (navMain) {
21+
navMain.onclick = function onClick() {
22+
if (navMain) {
23+
navMain.classList.remove("show");
24+
}
25+
}
26+
}
27+
}
1728

29+
}

0 commit comments

Comments
 (0)