A
A
Alexey2016-04-06 12:49:28
Angular
Alexey, 2016-04-06 12:49:28

How to hide/skip an element in ng-repeat output?

Good afternoon!
I just started learning Angular, everything is fine, but I ran into a problem.
JSON:

[
    {
        "id":"3",
        "name":"Главная страница",
        "key":"glavnaya_stranica"
    },
    {
        "id":"4",
        "name":"Блог",
        "key":"blog"
    }
]

HTML:
<ul class="float-right">
    <li ng-repeat="item in list"><a href="#/{{item.key}}" id="menuItem">{{item.name}}</a></li>
</ul>

Result:
<ul class="float-right">
    <li><a href="#/glavnaya_stranica" id="menuItem">Главная страница</a></li>
    <li><a href="#/blog" id="menuItem">Блог</a></li>
</ul>

Question: How can I skip (hide) LI="Main page" when displaying?
The problem seems simple, but I haven't found a solution yet.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Yarkov, 2016-04-06
@Alextos

<ul class="float-right">
    <li ng-if="item.id != 3" ng-repeat="item in list"><a href="#/{{item.key}}" id="menuItem">{{item.name}}</a></li>
</ul>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question