I'm currently developing a blogging software and have implemented an AngularJS dropdown for selecting post terms. Here's the code:
<select multiple="multiple" name="terms" ng-model="post.data.attributes.term_ids" required>
<option value="" disabled="" selected="">Tags</option>
<option ng-repeat="term in terms | filter: { taxonomy: 'tag' } " value="{{term.id}}">{{term.name}}</option>
</select>
While this works when creating posts, I'm facing an issue when trying to edit posts. I want to display the terms that were previously selected during post creation.
In other words, if the term's ID matches any in `post.data.attributes.term_ids`, then it should be pre-selected in the dropdown. I've gone through the documentation and examples but still haven't figured out how to achieve this. Any help would be greatly appreciated.