Created
March 21, 2014 08:01
-
-
Save jerry-tao/9681651 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="container" ng-controller="MainCtrl"> | |
{{tabs|json}} | |
<my-tabs> | |
</my-tabs> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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) { | |
} | |
}; | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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