Ben
Ben
KPCKevin Powell - Community
Created by Ben on 6/15/2024 in #front-end
Angular and nest.js help
No description
3 replies
KPCKevin Powell - Community
Created by Ben on 6/15/2024 in #front-end
Angular and nest.js help
and
//home.component.ts
import { Component, OnInit } from '@angular/core';
import { HymnsModel } from '../models/hymns.model';
import { HymnsService } from '../services/hymns.service';
import { NgFor } from '@angular/common';

@Component({
selector: 'app-home',
standalone: true,
imports: [NgFor],
templateUrl: './home.component.html',
styleUrl: './home.component.css'
})
export class HomeComponent implements OnInit {
hymns: HymnsModel[] = [];

constructor(private _hymnsService: HymnsService){}

ngOnInit(): void {
this._hymnsService.getAllHymns().subscribe( hymns => {
this.hymns = hymns;
})
}
}
//home.component.ts
import { Component, OnInit } from '@angular/core';
import { HymnsModel } from '../models/hymns.model';
import { HymnsService } from '../services/hymns.service';
import { NgFor } from '@angular/common';

@Component({
selector: 'app-home',
standalone: true,
imports: [NgFor],
templateUrl: './home.component.html',
styleUrl: './home.component.css'
})
export class HomeComponent implements OnInit {
hymns: HymnsModel[] = [];

constructor(private _hymnsService: HymnsService){}

ngOnInit(): void {
this._hymnsService.getAllHymns().subscribe( hymns => {
this.hymns = hymns;
})
}
}
I'm getting this error:
3 replies