Eduardo Serrano
Eduardo Serrano

Reputation: 31

AngularJS - I need help using the ng-show directive in HTML to comapre {{type}} to a String

Here is the code: In this case the Variable {{Type}} will be equals to the String 'Exception'. When that happens I want to show the column called 'Total Cases' look a the 3rd that is the code that does not work. What I am doing wrong?

            <div class="textbox_content">
                <div>
                    <table width="100%">
                        <thead id="report_content_headers">
                            <tr>
                                <th>{{type}}</th>
                                <th>Total Unloads</th>
                                <th ng-show="{{type}} === 'Exception'">Total Cases (re-worked)</th>
                                <th>Total Pallets (re-worked)</th>
                                <th>Load Type ( BD/MX )</th>
                                <th>Load Type ( Runout )</th>
                                <th>Load Type ( Floor )</th>
                                <th>{{type}}</th>

                            </tr>                               
                        </thead>
                        <tbody ng-repeat="metric in results | orderBy:'unloads':true" id="reportRow_{{$index}}">
                            <tr id="report_content_background" class="metrics">
                                <td align="center" ng-click="toggleReport($index, metric)">
                                    {{metric.shortName}} 
                                    <img src="${pageContext.request.contextPath}/resources/images/adminium/led-icons/chart_bar.png">
                                </td>
                                <td align="center">{{ metric.unloads | number:0 }}</td>
                                <td align="center">{{ metric.cases | number:0 }}</td>
                                <td align="center">{{ metric.pallets | number:0 }}</td>
                                <td align="center">{{ metric.bdmx || '0' }}</td>
                                <td align="center">{{ metric.runout || '0' }}</td>
                                <td align="center">{{ metric.other || '0' }}</td>
                            </tr>
                            <tr class="metric-details" ng-if="report[metric.shortName]">
                                <td align="center" colspan="7">
                                    <div id="firstChart_{{$index}}" style="width: 500px; height: 400px; float: left;">
                                    </div>
                                    <div id="secondChart_{{$index}}" style="width: 500px; height: 400px; float: left;">
                                    </div>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>

Upvotes: 0

Views: 24

Answers (1)

Eduardo Serrano
Eduardo Serrano

Reputation: 31

I found the solution: I removed the curly braces from {{type}}

<th ng-show="type == 'Exception'">Total Cases (re-worked)</th>

Upvotes: 0

Related Questions