I found this code snippet on this website. It seems to work fine, but when I click on a tab, instead of changing the content in the body (
<a href="#tab2success" data-toggle="tab">
), it redirects to localhost:9000/#tab2success, which doesn't exist. How can I make it so that clicking on the tab takes me to the specific content within the body? It appears that using the href
attribute isn't the solution here...
<div class="col-md-9">
<div class="panel with-nav-tabs panel-success">
<div class="panel-heading">
<ul class="nav nav-tabs">
<li class="active"><a href="#tab1success" data-toggle="tab">Success 1</a></li>
<li><a href="#tab2success" data-toggle="tab">Success 2</a></li>
<li><a href="#tab3success" data-toggle="tab">Success 3</a></li>
</ul>
</div>
<div class="panel-body">
<div class="tab-content">
<div class="tab-pane fade in active" id="tab1success">Success 1</div>
<div class="tab-pane fade" id="tab2success">Success 2</div>
<div class="tab-pane fade" id="tab3success">Success 3</div>
</div>
</div>
PS: I'm using AngularJS, so if there are any directives or solutions that could help, please let me know.
UPDATE: Here is a snippet of my router implementation. It's just a part of the code as it's too long to post everything here..
angular
.module('Test', [ //setting a module
'oc.lazyLoad',
'ui.router',
'ui.bootstrap',
'angular-loading-bar'
])
.config(['$stateProvider', '$urlRouterProvider', '$ocLazyLoadProvider', function ($stateProvider, $urlRouterProvider, $ocLazyLoadProvider) {
$ocLazyLoadProvider.config({
//$ocLazyLoad returns a promise that will be rejected when there is an error but if you set debug to true, //$ocLazyLoad will also log all errors to the console.
debug: false,
events: true,
});
// For any unmatched url, redirect to '/dashboard/home'
$urlRouterProvider.otherwise('/dashboard/rank');
// Now we set up the states
$stateProvider
.state('dashboard', { //parent view
url: '/dashboard',
templateUrl: 'views/dashboard/main.html',