Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { Component, OnInit } from '@angular/core';
- import { Title } from '@angular/platform-browser';
- import { Router } from '@angular/router';
- import { Location } from '@angular/common';
- import { StoreFrontService } from 'src/app/module/store-front/store-front.service';
- import { Section } from 'src/app/model/response/section';
- @Component({
- selector: 'app-home-page',
- templateUrl: './home-page.component.html',
- styleUrls: ['./home-page.component.scss']
- })
- export class HomePageComponent implements OnInit {
- datasection?: Section;
- loading = false;
- route?:string;
- constructor(
- private titleService: Title,
- private storefrontservice: StoreFrontService,
- private location: Location,
- private router: Router,
- ) {
- this.titleService.setTitle('TELKOMSEL API Marketplace');
- router.events.subscribe(
- (val) => {
- if (location.path() === '') {
- this.route = location.path();
- }
- });
- }
- ngOnInit() {
- this.refreshList();
- }
- refreshList() {
- this.loading = true;
- this.storefrontservice.getHomePage().subscribe((res:any) => {
- this.datasection = res.data;
- this.loading = false;
- },
- (error:any) => {
- this.loading = false;
- console.log(error);
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement