Reputation: 21
How can you use the href link in the angular tab directive to go to a view via routing. Somehow I think you have to add the root scope to the directive.
appTreeDirectives.directive('tabs', function() { return { restrict: 'E', transclude: true, scope: {}, controller: function($scope, $element) { var panes = $scope.panes = [];
$scope.select = function(pane) {
angular.forEach(panes, function(pane) {
pane.selected = false;
});
pane.selected = true;
}
this.addPane = function(pane) {
if (panes.length == 0)
$scope.select(pane);
panes.push(pane);
}
},
template:
'<div class="tabbable">' +
'<ul class="nav nav-pills nav-stacked">' +
'<li ng-repeat="pane in panes" ng-class="{active:pane.selected}">'+
'<a href="" ng-click="select(pane)"> <i class="fa fa-list-alt fa-lg"></i></span> {{pane.title}}</a>' +
'</li>' +
'</ul>' +
'<div class="tab-content" ng-transclude></div>' +
'</div>',
replace: true
};
Upvotes: 2
Views: 268
Reputation: 1712
You can write hashtag into a href to navigate.
<a href="#/viewName">Navigate to a view</a>
Upvotes: 0