简体   繁体   中英

Angular 1.4.7 ng-if syntax issue

Why this doesn't work for my angular template view?

  <tr class="warning" ng-repeat="aIpacmTableLine in ipacmMacArray">
    <td><font color=SteelBlue>{{aIpacmTableLine}}</td>

    <td><font color=SteelBlue>
        <div ng-if="{{ipacmIpArray[$index]}} !== \"0.0.0.0\"">
            <a ng-href="{{ipacmIpArray[$index]}}">
                {{ipacmIpArray[$index]}}
            </a>
        </div>

        <div ng-if="{{ipacmIpArray[$index]}} === \"0.0.0.0\"">
            {{ipacmIpArray[$index]}}
        </div>
    </td>
</tr>

While this works

  <tr class="warning" ng-repeat="aIpacmTableLine in ipacmMacArray">
    <td><font color=SteelBlue>{{aIpacmTableLine}}</td>

    <td><font color=SteelBlue>
        <div>
            <a ng-href="{{ipacmIpArray[$index]}}">
                {{ipacmIpArray[$index]}}
            </a>
        </div>
    </td>
</tr>

This is in a template view html file.

插值指令{{}}ng-if/ng-show不起作用,您应该直接提供要评估的表达式。

<div ng-if="ipacmIpArray[$index] !== '0.0.0.0'">

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM