I'm using angular strap to display a 3 tab panel. I wrap the angular strap bs-tabs directive with my tabbed-Panel directive. I do that so in the future I can animate the entire tabbed panel with my directive. It displays fine. What I cannot figure out, is how to handle clicks on tabs (ng-repeat objects) with my directive. I have a controller inside my directive and I use it to display the tab data but I can't figure out how to make it handle tab clicks (onTabClick)...is the this the right way to do it or should I use link (which I commented out below)?
HTML:
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<tabbed-Panel class="bottomTabPanel">
<div data-fade="1" ngModel="activeTab" bs-Tabs>
<div ng-repeat="tab in tabs" data-title="{{tab.title}}">
<p ng-click="onTabClick(tab)">{{tab.content}}</p>
</div>
</div>
</tabbed-Panel>
</body>
</html>
DIRECTIVE:
angular.module('directives', ['opsimut','$strap.directives'])
.directive('tabbedPanel',function() {
return {
restrict:"E",
controller: function($scope) {
$scope.tabs = [
{title:'Question 1', content: 'Question 1 content here'},
{title:'Question 2', content: 'Question 2 content here'},
{title:'Indication', content: 'Indication content here'}
];
$scope.tabs.activeTab = 2;
$scope.onTabClick = function(tab) {
debugger;
}
}
};
});