Among my plethora of templates, I'm seeking a way to handpick one from the list and transfer its ID to an input field within a form. Here's how my setup appears:
<form>
<input type="hidden" name="template_id" ng-model="template.template_id" />
<input type="text" name="template_name" ng-model="template.template_name" />
<ul>
<li id="1">Template1</li>
<li id="2">Another Template</li>
</ul>
<button type="submit"></button>
</form>
My goal is to dynamically change the content in the inputs by clicking on any of the <li>
elements. Would it be possible to achieve this functionality using a directive? Appreciate your insights! - Daniel.
Upon selecting the first item from the list, I envision the input fields with template_id and template_name to reflect Values 1 and "Template1" respectively. Similarly, picking the second item should adjust template_id to 2 and template_name to "Another Template".