0

My code as below in html file:

<ul class="main-icons"  ng-if="showMainIcons">
   <li ng-repeat="programData in tab.data">
      <img src="{{programData.icon}}"
           ng-click="programClicked($event,programData,tab)">
       // some another codes
    </li>
</ul>

<ul class="details-icons"  ng-show="tab.data.id"> 
   // some codes
</ul>

code in controller

$scope.programClicked = function($event,programData, tabData) {

        var newVar =  tabData.data.id;
        $scope.newVar = true;
        $scope.showMainIcons = false;
}

I am displaying multiple tabs, now in one tab if I click on some icon it will display the details, instead of this it is displaying all tabs details, not particular tab and I have to pass param in function while using ng-click

also I tried to pass the flag variable true/ false, its also displaying all tabs as like in controller

$scope.showDetails = true; 
$scope.showMainIcons = false

Thanks in advance

4
  • You realize that this var newVar = tabData.id; is never used? Commented Mar 12, 2019 at 14:31
  • you are looping over tab.data, so I guess tab.data is an array. And you are writing tab.data.id in ng-show - shouldn't it be something like tab.data[0].id? I meant shouldn't you use an index to access that? Commented Mar 12, 2019 at 14:45
  • @Chris it is my way, that I am implemented this way, its not working, I need and idea, how to display div by using dynamic id Commented Mar 12, 2019 at 14:47
  • @ArnabRoy, yes, its so, its bunch of multiple array, I am getting it by ng-repeat, I want to display div by passing dynamic id, if I pass same variable name or id, then it is displaying all tabs at a time, I want if I click on particular tab, then on particular tab data will display Commented Mar 12, 2019 at 14:49

1 Answer 1

0

As I can see your html code is :

<ul class="details-icons"  ng-show="tab.data.id"> 
   // some codes
</ul>

so here you are using: "tab.data.id" but in controller you are using : var newVar = tabData.id; I think it should : var newVar = tab.data.id;

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

1 Comment

I used the same way in html, and I am passing tab varibale from html and getting this value in tabData varibale. When I tried this way then its not working

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.