Relative Content

Tag Archive for javascriptalpine.js

show counter for nested loop using alphine js

I am trying to add the counter based on the provider. It should be global not service wise. I mean if there are 2 services and both of them have 2 providers, then it should show the counter like provider 1 and 2 for first service, then provider 3 and 4 for next service.

Alpine.js: ‘fruit is not defined’ error when using x-sort directive in Chrome Developer Tools

<!DOCTYPE html> <html lang=”en”> <head> <meta charset=”UTF-8″> <meta name=”viewport” content=”width=device-width, initial-scale=1.0″> <title>Document</title> <!– Alpine Plugins –> <script defer src=”https://cdn.jsdelivr.net/npm/@alpinejs/[email protected]/dist/cdn.min.js”></script> <!– Alpine Core –> <script defer src=”https://cdn.jsdelivr.net/npm/[email protected]/dist/cdn.min.js”></script> </head> <body> <ul x-data=”{ fruits:[‘durians’,’apples’,’oranges’] }” x-sort> <template x-for=”fruit in fruits”> <li x-text=”fruit” x-sort:item></li> </template> </ul> </body> </html> The code above works well when I’m just running it normally […]

Cycle inside cycle AlpineJS

Im new in alpineJS. I read official documentation and google, but I have not found any answer to the question: how to loop through nested array? Example: