-
Notifications
You must be signed in to change notification settings - Fork 0
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem with HTML containing anchor tags with href attributes that point to element IDs. #1
Comments
I have checked in my code to the develop branch on my Aurelia Test Project. If it's helpful for you to see the issue, just clone the repo, setup per instructions, run it and click the "Dynamic HML Test" link in the nav bar. Then choose the "Site Settings" option from the dropdown and click "Get Settings" button to load it. Everything seems fine until you click one of the tabs. Open the console to see the error.
|
This is related to the router. Any anchor tag with an href that starts with Basically you've got 4 options here:
Closing this since it's not related to dynamic-html element. This behavior will also occur for static html. |
The weird thing is the exact same code works fine in normal views. It's only when getting Aurelia to process this dynamic view that there's a problem. Any idea why that is? Anyway, I will look at the options you've mentioned. Thanks for the help; much appreciated. |
Now that you mention that, I did notice there were no bootstrap event handlers attached to the anchors so the click events aren't being intercepted. That's probably why it works in static views but not in a dynamic one. You need to tell bootstrap to do something (initialize?) after the dynamic html is compiled. I just released <dynamic-html
html.bind="html"
context.bind="context"
compiled.delegate="handleCompiled($event)">
</dynamic-html> handleCompiled($event) {
const dynamicHtml = $event.detail;
// this is the dynamic-html element
const el = dynamicHtml.el;
// something like this, don't know the exact api constraints
$(el.querySelectorAll('[data-toggle="tab"]')).tab();
} |
The latest version gives a 404 error for |
Sorry about that. I switched to rollup for single file output but that was a bad idea apparently. It should be fixed now with 0.3.1 |
You sir, are the man. It works perfectly now. You can see it in action if you want on a demo page in my test project here: https://github.com/gordon-matt/aurelia-razor-netcore2-skeleton. Thanks very much. |
When the HTML contains anchor tags with an href that points to an element ID. It complains about no such route being defined. The reason I have such markup is because it has Bootstrap tabs. Example:
<a href="#Themes" aria-controls="Themes" role="tab" data-toggle="tab">Themes</a>
Which points to the tab panel as follows:
The text was updated successfully, but these errors were encountered: