Created
September 15, 2022 04:44
-
-
Save odhiambo123/4742982383618d361b84aac1b96f7253 to your computer and use it in GitHub Desktop.
get items from the api endpoint
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, OnInit } from '@angular/core'; | |
import {DataService} from "../../services/data.service"; | |
@Component({ | |
selector: 'app-category', | |
templateUrl: './category.component.html', | |
styleUrls: ['./category.component.css'] | |
}) | |
export class CategoryComponent implements OnInit { | |
categories : any[] = []; | |
constructor(private dataService: DataService) { } | |
ngOnInit(): void { | |
this.dataService.getCategories().subscribe((response: any) => { | |
this.categories = response.data; | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment