Topic: Serious issues with Angular sidenav simple link
indijosh free asked 7 years ago
<mdb-item class="no-collase"> <mdb-item-head mdbRippleRadius ><i class="fa fa-tachometer"></i> Dashboard</mdb-item-head> <mdb-item-body></mdb-item-body> </mdb-item>Which compiles to...
<mdb-item class="no-collase"> <div class="card is-collapsed" ng-reflect-klass="card" ng-reflect-ng-class="[object Object]"> <mdb-item class="no-collase"> <div class="card is-collapsed" ng-reflect-klass="card" ng-reflect-ng-class="[object Object]"> <mdb-item-head mdbrippleradius=""> <div class="card-header"> <a role="button"> <h5 class="mb-0"> <i class="fa fa-calendar-o"></i> Dashboard <i class="fa fa-angle-down rotate-icon"></i> </h5> </a> </div> </mdb-item-head> <mdb-item-body> <div class="sb-item-body" style="height: 0px;"> <div class="card-body"> </div> </div> </mdb-item-body> </div> </mdb-item>So my questions, 1. Why are the Angular Sidenav items wrapped in an H5? 2. Do you have an example application of where you are using the Angular version of MDB? 3. Why is there so much more going on than the JQuery version of the Sidenav? It seems a bit overkill to use cards and have an empty body for each simple sidenav link. 4. (Most importantly) How do we get an href on the anchor without injecting it with .js? In the collapsible example, the anchors are not generated allowing you to add the href.
Adrian Sawicki free answered 7 years ago
AgentEnder free commented 4 years ago
Angular routing should not be used when navigating to an external url, or a user-provided link in my case (as I am allowing moderators to customize their sidebars). I know this is an old question, but there should be a way to bind to the href and title of that anchor tag if it is going to be inserted.
AgentEnder free answered 4 years ago
This is an old question, but the issue with not being able to provide an href for the link still exists (somehow? I thought this was basic html requirements).
In the sidenav if you replace the sample code for the simple link with this:
<li>
<a [href]="l.href" [title]="l.title">
<mdb-icon
far
icon="hand-pointer"
></mdb-icon>
{{ l.title }}
</a>
</li>
everything seems to work pretty well. The styling is a little bit different, but its really close. Hopefully this helps someone else out, it took way too long for me to find.
Konrad Stępień staff commented 4 years ago
Hi @AgentEnder,
Thank you for your answer. I will look at this problem and take your suggestion for a fix the issue.
Best, Konrad.
lpoore pro answered 6 years ago
Adrian Sawicki free answered 7 years ago
indijosh free commented 7 years ago
Adrian, Thanks for the reply! I really do appreciate how quick and succinct you all are with replying. As for #4 above, I'm looking to create a single link but I don't know where to put the href. Here's the code from the angular sidenav example: <pre><mdb-item class="no-collase"> <mdb-item-head mdbRippleRadius><i class="fa fa-hand-pointer-o"></i> Simple link</mdb-item-head> <mdb-item-body></mdb-item-body> </mdb-item></pre> And this generates the sidenav item with the anchor, but I don't know how to change the href of the anchor since it's generated. If I manually add an anchor to the link like the code example below, an anchor is still generated and causes my anchor to lose the (click) property and be nested inside of the generated anchor: <pre><mdb-item class="no-collase"> <mdb-item-head mdbRippleRadius><a (click)="changeRoute('docs')"><i class="fa fa-archive"></i> Document Center</a></mdb-item-head> <mdb-item-body></mdb-item-body> </mdb-item></pre>Jan Louw pro commented 7 years ago
Hi, any resolutions to this? Any code examples for simple links from sidenav? RegardsFREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- ForumUser: Free
- Premium support: No
- Technology: MDB Angular
- MDB Version: -
- Device: -
- Browser: -
- OS: -
- Provided sample code: No
- Provided link: No