-1

I'm new to AngularJS. I'm using carousel inside the tab and I used the angular-responsive for making the images responsive across the devices(http://plnkr.co/edit/QhBQpG2nCAnfsb9mpTvj?p=preview). I want to attach a class called 'active' to for the first tab by default if the tab name is 'All products'. To achieve this I have added the ng-class attribute as below:

<div id="category_list" ng-controller="MainContorller">
  <div class="display-mode" dn-display-mode="displayMode"></div>
  <div ng-controller="CategoryListController">
    <uib-tabset active="activeTab">
      <uib-tab index="$index" ng-repeat="prodCategory in productsByCategory" heading="{{prodCategory.slideName}}" ng-class="{'active': prodCategory.slideName == 'All products'}">
        <div>
          <div style="height: 305px">
            <div uib-carousel active="activeCarousel" interval="myInterval" no-wrap="noWrapSlides">
              <div uib-slide ng-repeat="slideCollection in prodCategory.slides" index="$index">
                <div class="col-sm-3 col-lg-2">
                  <div class="product-box">
                    <div class="product-image"><img ng-src="{{slideCollection.image1.product.product_image.src}}"></div>                    
                  </div>
                </div>                
              </div>
            </div>
          </div>
        </div>
      </uib-tab>
    </uib-tabset>
  </div>
</div>   

AngularJS version : 1.3.4

This shows the following error:

Error: [$parse:syntax] Syntax Error: Token ',' is unexpected, expecting []] at column 92 of the expression [{'active': prodCategory.slideName == 'All products' } [{active: active, disabled: disabled}, classes]] starting at [, classes]].

2 Answers 2

1

OK according to this topic you are not able to use ng-class directly on uib-tabset but you can do this

   <uib-tab-heading ng-class="{'tab-all-products': prodCategory.slideName == 'All products'}">
      <span>{{prodCategory.slideName}}</span>
    </uib-tab-heading>

and it will work fine :-) Here is Plnkr with working example.

Sign up to request clarification or add additional context in comments.

Comments

0

You have some problem in your directive uib-tab. I tried to simulate your problem and when you replace that directive with a span it works so there is no problem with ng directives. If you can please post your directive here.

btw i created Plnkr

1 Comment

Thank you for your effert! I have updated my question. I'm trying to use carousel inside the tabs with responsive feature.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.