I have an input which uses angular to generate a list of names, and I want each name to be a link that submits the form with the name as the input value.
<form method="POST" action="/results/" id="artform>
{% csrf_token %}
Search:<input type="text" name="search" ng-model="search" />
<input type="submit" value="Submit" />
</form>
<table ng-controller="mycontroller">
<tr ng-repeat="artist in artists | filter:search | limitTo:10">
<td ng-hide="!search">
<a class="click-me" href="javascript:$('#artform').submit();">
{({ artist })}
</a>
</td>
</tr>
</table>
<script>
(function ($){
$(function () {
$('body').delegate('.click-me', 'click', function (){
$('input[name="search"]').val({({ artist })});
});
});
})(jQuery);
</script>
The .val({({ artist })}); is where I want to inject whatever the value of {({ artist })} is, since I want the link to submit the form with the name as the value. How can I get the angular variable into the jquery?