angularjs - The Right Way to Do Tab Navigation in Angular / Bootstrap -
i want set tab based navigation web site using angular , bootstrap , want 'right' way. far can tell 'right' way set angular site via angular seed. implemented , got templated multi file tab site following basic ingredients.
with angular
index.html:
<ul class="nav nav-tabs"> <li class="active"><a href="#/view1">home</a></li> <li><a href="#/view2">menu 1</a></li> </ul> <div ng-view></div> <div>angular seed app: v<span app-version></span></div> view1.js:
'use strict'; angular.module('myapp.view1', ['ngroute']) .config(['$routeprovider', function($routeprovider) { $routeprovider.when('/view1', { templateurl: 'view1/view1.html', controller: 'view1ctrl' }); }]) .controller('view1ctrl', [function() { }]); view1.html:
<div>here's html</div> ...for view2.
with bootstrap
as far can tell 'right' way implement tabs bootstrap follows:
index.html:
<div class="container"> <div id="content"> <ul id="tabs" class="nav nav-tabs" data-tabs="tabs"> <li class="active"><a href="#red" data-toggle="tab">red</a></li> <li><a href="#orange" data-toggle="tab">orange</a></li> <li><a href="#yellow" data-toggle="tab">yellow</a></li> <li><a href="#green" data-toggle="tab">green</a></li> <li><a href="#blue" data-toggle="tab">blue</a></li> </ul> <div id="my-tab-content" class="tab-content"> <div class="tab-pane active" id="red"> <h1>red</h1> <p>red red red red red red</p> </div> <div class="tab-pane" id="orange"> <h1>orange</h1> <p>orange orange orange orange orange</p> </div> <div class="tab-pane" id="yellow"> <h1>yellow</h1> <p>yellow yellow yellow yellow yellow</p> </div> <div class="tab-pane" id="green"> <h1>green</h1> <p>green green green green green</p> </div> <div class="tab-pane" id="blue"> <h1>blue</h1> <p>blue blue blue blue blue</p> </div> </div> </div> after lots of messing around still can't seem boot strap functionality, using angulars templated model. can advise me on 'right' way this?
take @ ui bootstrap. it's bootstrap components built angular directives. there's tabs directive simplify you're trying accomplish.
Comments
Post a Comment