Skip to content
This repository has been archived by the owner on Dec 1, 2023. It is now read-only.

Commit

Permalink
chore(tab): split template to separate file
Browse files Browse the repository at this point in the history
  • Loading branch information
mgcrea committed Jan 23, 2014
1 parent 51b864a commit 1ba73ba
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
13 changes: 1 addition & 12 deletions src/tab/tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,13 @@ angular.module('mgcrea.ngStrap.tab', [])

$templateCache.put('$pane', '{{pane.content}}');

var template = '<ul class="nav nav-tabs">' +
'<li ng-repeat="pane in panes" ng-class="{active:$index==active}">' +
'<a data-toggle="tab" ng-click="setActive($index, $event)" data-index="{{$index}}">{{pane.title}}</a>' +
'</li>' +
'</ul>' +
'<div class="tab-content">' +
'<div ng-repeat="pane in panes" class="tab-pane" ng-class="[$index==active?\'active\':\'\']" ng-include="pane.template || \'$pane\'"></div>' +
'</div>';

$templateCache.put('$tabs', template);

})

.provider('$tab', function() {

var defaults = this.defaults = {
animation: 'animation-fade',
template: '$tabs'
template: 'tab/tab.tpl.html'
};

this.$get = function() {
Expand Down
8 changes: 8 additions & 0 deletions src/tab/tab.tpl.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<ul class="nav nav-tabs">
<li ng-repeat="pane in panes" ng-class="{active: $index == active}">
<a data-toggle="tab" ng-click="setActive($index, $event)" data-index="{{$index}}">{{pane.title}}</a>
</li>
</ul>
<div class="tab-content">
<div ng-repeat="pane in panes" class="tab-pane" ng-class="[$index == active ? 'active' : '']" ng-include="pane.template || '$pane'"></div>
</div>

0 comments on commit 1ba73ba

Please sign in to comment.