Ich sehe es gibt eine Lücke in Ihrem Code für parent_id und Projekt-ID. Ich habe einen Code für Ihre Anforderung geschrieben. Wenn ich richtig verstanden habe, möchten Sie das Projekt anzeigen, wenn die ID dieses Projekts parent_id entspricht. Ich habe update ng-Optionen für Sie korrekt, wie sie nach "ID" des Projekts verfolgen sollten.
Suchen Sie etwas wie http://codepen.io/aechannaveen/pen/NABbXq?
<html ng-app="myApp">
<head>
<title>
My Angular App
</title>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" type="text/css">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js">
</script>
</link>
</head>
<body class="container" ng-controller="InputCtrl">
<select class="form-control" id="projects" ng-model="project" ng-options="project as project.groupingName for project in projects track by project.id">
</select>
<div ng-show="project.id === parent_id">
Project Selected :{{ project.groupingName }}
</div>
</body>
</html>
Und
angular.module('myApp', []).controller('InputCtrl', ['$scope',function($scope) {
$scope.parent_id = 2;
$scope.projects = [
{
"groupingName": "ABC",
"id": 1
},
{
"groupingName": "CDE",
"id": 2
} ];
}]);
So verwenden Sie 'ng-options' und eine verschachtelte' ng-repeat'? – austinthedeveloper
Entschuldigung - Ich habe das Code-Snippet aktualisiert – Shamoon
Bitte erläutern Sie, was Sie zu tun versuchen. – developer033