, но не в дочерних строках.
Код: Выделить всё
Team Name
City
State
▶
▼
{{ group.team.name }}
{{ group.team.city }}
{{ group.team.stateProvince }}
Flights: {{group.flights|json}}
Flight #:[/b] {{ flight.flightNumber }}[b]
Departure:[/b] {{ flight.departureCity }} at {{ flight.departureTime }}[b]
Arrival:[/b] {{ flight.arrivalCity }} at {{ flight.arrivalTime }}
No flights available for this team.
Код: Выделить всё
$scope.expandedTeams = {}; // Tracks expanded states by team ID
$scope.flights = {}; // Cache flights by team ID
$scope.toggleFlights = function (teamId) {
// Toggle expanded state
if ($scope.expandedTeams[teamId]) {
$scope.expandedTeams[teamId] = false; // Collapse
} else {
$scope.expandedTeams[teamId] = true; // Expand
// Fetch flights dynamically if not already cached
if (!$scope.flights[teamId]) {
const group = $scope.groupedFlights.find(g => g.team.id === teamId);
$scope.flights[teamId] = group ? group.flights : [];
}
}
};
Код: Выделить всё
Flights: {{group.flights|json}}
Код: Выделить всё
Подробнее здесь: https://stackoverflow.com/questions/793 ... -angularjs