In my quest to quickly display a list of all the authors linked to a particular publication, I've encountered an issue.
Everything runs smoothly when $scope.publications.authors
holds a single value. However, problems arise when there are multiple values stored in an array, as shown below.
I understand that the conditional statement for the AngularJS ngShow directive is not suitable for arrays, but I'm struggling to find the correct approach.
HTML:
<div ng-repeat="person in persons" ng-show="person.firstName == publication.authors">{{person.firstName}}</div>
JS:
$scope.publications = [
{"title": "Research Paper",
"authors": ["Bill", "George"]};
$scope.persons = [
{"firstName": "Bill",
"lastName": "Smith"},
{"firstName": "George",
"lastName": "Jones"},
{"firstName": "Mike",
"lastName": "Thomas"};