• Skip to main content
  • Skip to primary sidebar

Web Development Archive

  • Archive
You are here: Home / Angular / Mock Service

Mock Service

import { Injectable } from '@angular/core';
import { Card } from '@app/shared';

@Injectable({
providedIn: 'root'
})
export class FaqService {
public getData(): readonly Card[] {
return [
{ title: 'FAQ_1.Q', desc: 'FAQ_1.A' },
{ title: 'FAQ_2.Q', desc: 'FAQ_2.A' },
{ title: 'FAQ_3.Q', desc: 'FAQ_3.A' },
];
}
}
export class FaqComponent implements OnInit {
private readonly _faqService = inject(FaqService);
public data: readonly Card[];

public ngOnInit(): void {
this.data = this._faqService.getData();
}
}
<ng-container *ngFor="let item of data; let i = index">
<app-accordion />
</ng-container>

Filed Under: Angular

About Gabor Flamich

I'm a web developer and designer based in Budapest, Hungary. In recent years, I've documented hundreds of solutions I came across during development. This site is an archive for useful code snippets on WordPress, Genesis Framework and WooCommerce. If You have any questions related to WordPress development, get in touch!

Primary Sidebar

  • angular.io
© 2026 WP Flames - All Right Reserved