I need assistance as I am confused about how to select a specific item that originates from a different array. If selecting an item from another array is not feasible, then is there a way to locate and choose an item within the current array? Could you please provide an example if this is possible? PS: I managed to set an item by choosing it directly from an existing item, like so, but I wish to be able to pick it from a separate array.
$scope.initialMention = [
$scope.mentions[0][0],
$scope.mentions[1][0]
];
var app = angular.module('plunker', []);
app.controller('MainCtrl', function($scope) {
$scope.mentions = [
[
{
"name": "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="fa9e9f8c9f96958a9f88ba975b95969d989596999593d4909c9e">[email protected]</a>",
"uuid": "31a52cab-429d-4efa-91dc-d79b154dd4f9",
"type": "Users",
"selected": false,
},
{
"name": "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2541405340494a55405717654840414449494c44498a454941">[email protected]</a>",
"uuid": "020e5b7c-98b6-457a-a90e-d78253eef11d",
"type": "Users",
"selected": false,
},
{
"name": "testTeam 😀",
"uuid": "fe5b143c-c6c2-4d34-a152-2a679899541d",
"type": "Teams",
"selected": false,
},
{
"name": "41335412351235 😀",
"uuid": "d751eb81-7363-4f32-a91c-dc6c69d1c113",
"type": "Teams",
"selected": false,
}
],
[
{
"name": "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f99d9c8f9c9596899c8bb99495949fd3869094">[email protected]</a>",
"uuid": "31a52cab-429d-4efa-91dc-d79b154dd4f9",
"type": "Users",
"selected": false,
},
{
"name": "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c1a5a4b7a4adaeb1a4b3f1acb0aaa5aea3b8a4a8aa">[email protected]</a>",
"uuid": "020e5b7c-98b6-457a-a90e-d78253eef11d",
"type": "Users",
"selected": false,
},
{
"name": "testTeam 😀",
"uuid": "fe5b143c-c6c2-4d34-a152-2a679899541d",
"type": "Teams",
"selected": false,
},
{
"name": "41335412351235 😀",
"uuid": "d751eb81-7363-4f32-a91c-dc6c69d1c113",
"type": "Teams",
"selected": false,
}
]
]
$scope.initialMention = [
{
"name": "testTeam 😀",
"uuid": "fe5b143c-c6c2-4d34-a152-2a679899541d",
"type": "Teams",
"selected": false,
},
{
"name": "41335412351235 😀",
"uuid": "d751eb81-7363-4f32-a91c-dc6c69d1c113",
"type": "Teams",
"selected": false,
}
];
});
<!DOCTYPE html>
<html ng-app="plunker">
<head>
<meta charset="utf-8" />
<title>AngularJS Plunker</title>
<script>document.write('<base href="' + document.location + '" />');</script>
<link rel="stylesheet" href="style.css" />
<script data-require="<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="7e1f10190b121f0c50140d3e4f504e50076f0804190307df19192a">[email protected]</a>" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.js" data-semver="1.0.7"></script>
<script src="app.js"></script>
</head>
<body ng-controller="MainCtrl">
<br />
<br />
<br />
<div ng-repeat="mention in mentions">
<select
ng-model="initialMention[$index]"
ng-options="item as item.name for item in mention">
</select>
<br />
{{ initialMention[$index]}}
<br />
{{mention[$index]}}
</div>
</body>
</html>