I am using a tabset and sets of different tabs of angular ui bootstrap.
I would like to move in a click to some tab. Moreover, i would like to know which of the tabs is opened right now.
I created a variable in service called currentTab.
The idea is when i am clicking in a tab, the current tab is updated. I can move between the tabs , however, i got an error message in console: "Expression '{0}' used with directive '{1}' is non-assignable!"
Moreover, I have to draw every tab different.
Any ideas?
<tabset>
<tab active="currentService.isCurrentTabEqualsGivenName('tab1')" ng-click="currentService.setCurrentTab('tab1')">
<tab-heading><span class="badge">3</span> <span>Tab 1</span>
</tab-heading>
SOMETHING
</tab>
<tab active="currentService.isCurrentTabEqualsGivenName('tab2')" ng-click="currentService.setCurrentTab('tab2')">
<tab-heading>Tab 2</tab-heading>
SOMETHING
</tab>
</tabset>
CurrentService:
app.service('CurrentService', [
function () {
this.currentTab = "tab1";
this.isCurrentTabEqualsGivenName = function(name){
return this.currentTab === name;
};
this.setCurrentTab = function(name){
if (this.currentTab !== name)
this.currentTab = name;
};
}]);