My challenge involves having a list of items where the user can click on one, triggering a server request for that item's details. The retrieved values will then populate a div below based on the specific item selected.
This is what my current code looks like:
<div ng-controller="MarketCtrl">
Please select a market:
<?php foreach ($markets as $market): ?>
<span class="<?= strtolower(str_replace(' ', '_', $market)) ?>"><?= $market ?></span>
<?php endforeach; ?>
You have selected _______ as the market.
<div>
<!-- Load items based on the item selected above -->
</div>
</div>
I am interested in using AngularJS for this task, even though I am currently more familiar with jQuery. How should I approach this problem? Would creating a new directive and binding it to the elements be the best solution? I am still learning AngularJS through various resources but haven't come across a similar scenario yet.
Any guidance on this matter would be greatly appreciated. Thank you.