Angular
Error: src/app/app.component.html:3:29 - error TS2341: Property 'firebase_Data'
is private and only accessible within class 'AppComponent'.
Error:
src/app/app.component.html:3:29 - error TS2341:
Property 'firebase_Data' is private and only accessible within class
'AppComponent'.
3
<li *ngFor="let item of firebase_Data">
~~~~~~~~~~~~~
src/app/app.component.ts:8:16
8
templateUrl: './app.component.html',
~~~~~~~~~~~~~~~~~~~~~~
Error
occurs in the template of component AppComponent.
|
Ursache:
Eine Variable
die mit Angular in der Webseite angezeigt werden soll, ist in der .ts typescript
Datei nicht als public declariert
Lösung
Man muss die
Variablen in der app.component.ts mit public declarieren
In der app.component.ts
die variable als pulic deklarieren
export class AppComponent {
//--< Daten >--
title = 'dailycheck';
public firebase_Data;
|
Dann kann eine
Variable in der app.component.html angezeigt werden