Skip to content

Instantly share code, notes, and snippets.

@jerry-tao
Created March 21, 2014 08:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jerry-tao/9681651 to your computer and use it in GitHub Desktop.
Save jerry-tao/9681651 to your computer and use it in GitHub Desktop.
<div class="container" ng-controller="MainCtrl">
{{tabs|json}}
<my-tabs>
</my-tabs>
</div>
'use strict';
angular.module('tabsApp')
.controller('MainCtrl',function ($scope) {
$scope.tabs = [
{head: "tab1", content: "content1"},
{head: "tab2", content: "content2"},
{head: "tab3", content: "content13"}
];
}).directive('myTabs', function () {
return {
templateUrl: '/scripts/tabs.html',
replace: true,
restrict: 'E',
link: function (scope, element, attrs) {
},
controller: function ($scope) {
}
};
});
<div class="bs-example bs-example-tabs">
<ul id="myTab" class="nav nav-tabs">
<li ng-repeat="tab in tabs"><a href="#{{tab.head}}" data-toggle="tab">{{tab.head}}</a></li>
</ul>
<div id="myTabContent" class="tab-content">
<div ng-repeat="tab in tabs" class="tab-pane fade in" id="{{tab.head}}">
{{tab.content}}
</div>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment