I am looking to implement Tabs using Bootstrap 4 with bootstrap-native-v4 in an Angular 2 application. I have added bootstrap-native-v4 via the 'scripts' value in the angular.json file as "./node_modules/bootstrap.native/dist/bootstrap-native-v4.min.js". Upon inspecting the source code [scripts.js file] through Chrome Developer Tools, I can confirm that bootstrap-native-v4 is included.
Currently, I am running my application locally on localhost:4200/myfolder. However, when I interact with the tabs by hovering or clicking on them, the URL defaults to localhost:4200/#home instead of localhost:4200/myfolder#home, and similarly for other tabs such as localhost:4200/#profile instead of localhost:4200/myfolder#profile. This behavior results in a post back to a non-existent URL.
I have tried setting the BaseURL in the head section to address the URL issue, but this causes the content not to refresh upon tab selection. Additionally, assigning href values like myfolder#home, myfolder#profile to each anchor tag also resolves the URL issue, but the tab content does not refresh.
I prefer not to use JQuery (hence opting for bootstrap-native-v4) as most examples rely on it. I am exploring Data API for implementation (JavaScript within the scope of bootstrap-native-v4 is acceptable).
<!-- Nav tabs -->
<ul class="nav nav-tabs" id="myTab" role="tablist" data-tabs="tabs">
<li class="nav-item">
<a class="nav-link active" id="home-tab" data-toggle="tab" href="#home" role="tab" aria-controls="home" aria-selected="true">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" id="profile-tab" data-toggle="tab" href="#profile" role="tab" aria-controls="profile" aria-selected="false">Profile</a>
</li>
<li class="nav-item">
<a class="nav-link" id="messages-tab" data-toggle="tab" href="#messages" role="tab" aria-controls="messages" aria-selected="false">Messages</a>
</li>
<li class="nav-item">
<a class="nav-link" id="settings-tab" data-toggle="tab" href="#settings" role="tab" aria-controls="settings" aria-selected="false">Settings</a>
</li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div class="tab-pane active" id="home" role="tabpanel" aria-labelledby="home-tab">a...</div>
<div class="tab-pane" id="profile" role="tabpanel" aria-labelledby="profile-tab">b...</div>
<div class="tab-pane" id="messages" role="tabpanel" aria-labelledby="messages-tab">c...</div>
<div class="tab-pane" id="settings" role="tabpanel" aria-labelledby="settings-tab">d...</div>
</div>
I want the tab functionality to switch between tabs without triggering a server postback, simply displaying the corresponding tab's content.
If anyone has a solution to this issue, I would greatly appreciate the assistance.