0

I have the following code in the html. In the ng-click="inbox.showView('in: {{category|lowercase}}')" the double braces is not working because it is being considered as a string and not as a variable.

How do I ensure I have the category value in the ng-click event?

<li ng-repeat="category in inbox.categories track by $index">
                                <a href="#">
                                    <div class="left-row" ng-click="inbox.showView('in: {{category|lowercase}}')" target="_self">
                                        <div class="leftcolumn1"><span class="glyphicon glyphicon-user"></span></div>
                                        <div class="leftcolumn2">{{category}}</div>
                                        <div class="leftcolumn3 email-time" ng-bind="inbox.messageCounts.socialCount"></div>
                                    </div>
                                </a>
                            </li>
shashank
  • 326
  • 4
  • 6
  • 19

1 Answers1

0

In the controller:

$scope.inbox = {
                categories: ['Name', 'Test'],
                showView : function(variable) {
                    **console.log(variable);**
                }
            };

In the HTML given the parameter for showView function is object,, hence pass like the below inbox.showView({'in': (category | lowercase) })

<li ng-repeat="category in inbox.categories track by $index">
            <a href="#">
                <div class="left-row" ng-click="inbox.showView({'in': (category | lowercase) })" target="_self">
                    <div class="leftcolumn1"><span class="glyphicon glyphicon-user"></span></div>
                    <div class="leftcolumn2">{{category}}</div>
                    <div class="leftcolumn3 email-time" ng-bind="inbox.messageCounts.socialCount"></div>
                </div>
            </a>
        </li>