Home AngularJS when I click a link I want to filter an array
Reply: 0

AngularJS when I click a link I want to filter an array

user1438
1#
user1438 Published in June 19, 2018, 2:27 pm

I'm currently working with a website using PHP and AngularJS, I have a product list and a droplist that has some links which will allow the user to filter products by type(electric guitars, acoustic guitars, etc...) is there any way to do a function that filters the ng-repeat to only show products whose type are the selected one?

This is what I currently have:

<article class="producto" ng-repeat="product in dbproducts | filter:prodsearch">
    <div class="img">
        <img src="products/img/{{product.Imagen}}" alt="{{product.Marca + ' ' + product.Modelo}}">
        <p class="product-model">{{product.Marca + ' ' + product.Modelo}}</p>
        <span class="product-price">{{product.Precio | currency: '€'}}</span>
    </div>
    <div class="check">
        <div class="paygroup">
            <p class="price" ng-bind="product.Precio | currency: '€'"></p>
            <button class="buy"><i class="fa fa-shopping-cart"></i>{{'BUTTON_BUY' | translate}}</button>
            <p>{{'BUTTON_AVAILABLE' |translate}}: {{product.Unidades_disponibles}} </p>
        </div>
    </div>
    <div class="txt">
        <p>Test, hola,  {{ $index }}</p>
    </div>
    <span class="close fa fa-times fa-inverse"></span>
</article>
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.376947 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO