I am using Angular and Twitter Bootstrap navbar and trying to get the collapse functionality to work.
Partial: program.html
If you are looking for Angular2. Then blow is the changes required.
Angular2
and menu should look like this.
Dashboard Your controller should be be something like this. import { Component} from '@angular/core'; @Component({ selector: 'app-navbar', templateUrl: './navbar.component.html', styleUrls: ['./navbar.component.css'] }) export class NavbarComponent { isCollapsed: boolean = true; toggleCollapse(): void { this.isCollapsed = !this.isCollapsed; } } See, this is relatively easy in angular2. thanks to @yankee for the answer. 0 讨论(0) 查看其它8个回答 发布评论: 提交评论 加载中... 验证码 看不清? 提交回复
Your controller should be be something like this.
import { Component} from '@angular/core'; @Component({ selector: 'app-navbar', templateUrl: './navbar.component.html', styleUrls: ['./navbar.component.css'] }) export class NavbarComponent { isCollapsed: boolean = true; toggleCollapse(): void { this.isCollapsed = !this.isCollapsed; } }
See, this is relatively easy in angular2. thanks to @yankee for the answer.
angular2