W
W
westdp2016-04-27 12:12:30
Angular
westdp, 2016-04-27 12:12:30

How to implement this in AngularJS?

There is a list for example:

<ul class="choiceProducts">
            <li class="milkBlock" data-show="milk">Milk</li>
            ..........................................

And I traverse the array:
$scope.items = [
        {kkal:150, class: 'milk', name:'Full-fat milk', value : 100},
        {kkal:102, class: 'meatChicken', name:'Low fat milk (1%)', value : 100 },
        ..............................

How to make an analogue of a function written in jQuery write in Angular
$( document ).ready(function() {        
         $('.choiceProducts li').click(function(){
            var chosenCat = $(this).data('show');       
            $('.listSearch li').hide();
            $('.listSearch li.'+chosenCat).show();
         });
    });

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Pavel Shvedov, 2016-04-27
@westdp

https://jsfiddle.net/skqexru8/

D
Dmitry Kuznetsov, 2016-04-27
@dima9595

To output an array - ng-repeat, and to hide and show elements ng-show and ng-hide.
PS: I could be wrong...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question