app.config(['$stateProvider', function ($stateProvider) { $stateProvider.state('home', { url: '/', controller: 'prefsAcsController', template: '' }).state('edit', { url: '/edit', controller: 'prefsAcsCrudController', templateUrl: '/customerAccounts/PrefsAcs' }).state('accountUDFs', { url: '/AccountUDFs', templateUrl: '/customerAccounts/PrefsAcs/AccountsUDFs' }).state('invoiceUDFs', { url: '/InvoiceUDFs', templateUrl: '/customerAccounts/PrefsAcs/InvoiceUDFs' }).state('confirmationText', { url: '/ConfirmationText', templateUrl: '/customerAccounts/PrefsAcs/ConfirmationText' }); }]);and in the prefsAcsCrudController I have the following:
$scope.tabsViews = [{ index: 1, name: 'accountUDFs', invalid: false, title: resourceFactory.getResource('Labels', 'xUDFs').format(resourceFactory.getResource('Labels', 'account')) }, { index: 2, name: 'invoiceUDFs', invalid: false, title: resourceFactory.getResource('Labels', 'xUDFs').format(resourceFactory.getResource('Labels', 'invoice')) }, { index: 3, name: 'confirmationText', invalid: false, title: resourceFactory.getResource('Labels', 'confirmationText') } ]; function objectFindByKey(array, key, value) { for (var i = 0; i < array.length; i++) { if (array[i][key] === value) { return array[i]; } } return null; } $scope.previousIndex = null; $scope.selectView = function (viewIndex) { var newView = objectFindByKey($scope.tabsViews, 'index', viewIndex); if ($scope.previousIndex != null) { $scope.tabsViews[$scope.previousIndex - 1]["invalid"] = $scope.form.$invalid; } $scope.previousIndex = viewIndex; if (newView) { var viewName = newView["name"]; $state.go(viewName); } };and in the chtml page I placed:
<div class="col-lg-2 col-md-2 panel-container"> <tabset vertical="true" type="pills"> <tab ng-repeat="tab in tabsViews" select="selectView(tab.index)" class=" {{tabsViews[tab.index-1]['invalid'] ? 'invalid-tab': 'valid-tab' }}"> <tab-heading>{{tab.title}}</tab-heading> </tab> </tabset> </div> <div class="col-lg-10 col-md-10 panel-container"> <div data-ui-view data-autoscroll="false"></div> </div>All seems to work nicely.
<div class="col-md-12"> <div ng-bind-html="noInvoicesUserDefined"></div> </div>where noInvoicesUserDefined is this:
$scope.noInvoicesUserDefined = resourceFactory.getResource('Messages', 'noUserDefinedConfiguredX').format( "<a href='/CustomerAccounts/PrefsAcs#/InvoiceUDFs'>" + resourceFactory.getResource('Labels', 'invoices') + "-" + resourceFactory.getResource('Labels', 'preferences') + "</a>");It also works nicely and automatically the second tab is selected when I click on the link. This is exactly what I want. The only problem here is the active class is still on the very first tab (e.g. I see the UDF for Invoices but on the left I see Account User Defined highlighted tab).