Topic: Dropdown load selected item
kjimenezdev pro asked 7 years ago
Dawid Adach pro answered 7 years ago
Dear kijmenezdev,
Sure, you can easily do that:
component.html:
<div class="btn-group" dropdown> <buttondropdownToggletype="button"class="btn btn-primary dropdown-toggle waves-light"mdbRippleRadius> Basic dropdown </button> <divclass="dropdown-menu dropdown-primary"> <li role="menuitem" *ngFor="let link of links"><a class="dropdown-item" [class.active]="link.isActive"href="{{link.url}}">{{link.name}}</a></li> </div> </div>
Component.ts:
links= [ {id: 1, name: 'Google', url: 'http://google.com', isActive: false}, {id: 2, name: 'Microsfot', url: 'http://microsoft.com', isActive: false}, {id: 3, name: 'Facebook', url: 'http://facebook.com', isActive: true}, {id: 4, name: 'Yahoo', url: 'http://yahoo.com', isActive: false}, ];
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- User: Pro
- Premium support: No
- Technology: MDB Angular
- MDB Version: -
- Device: -
- Browser: -
- OS: -
- Provided sample code: No
- Provided link: No