В службе angular я хотел бы, чтобы метод возвращал свойство данных вместо всех данных.
Я пробовал это:
export class RecipeService {
private recipesUrl = 'http://localhost:8081/recipes';
constructor(private http: HttpClient) { }
getRecipes (): Observable<Recipe[]> {
return this.http.get<Recipe[]>(this.recipesUrl).pipe((data) => {
return of(data['recipes']);
});
}
}