Angular: Manage data
Where to
define the data and how to display the data
The data is
defined in the app.component.ts
Example:
multiple tasks in a table or array such as data set =['a','b','c']
aufgaben=['Aufgabe1','Aufgabe2','Aufgabe3'];
|
And shows
them in the app.compontent.html
<li *ngFor="let aufgabe of aufgaben">{{aufgabe}}</li>
|
Defining in
the .ts
Ads in the .html
And in the
edition app.component.html
Generated as
output in html
dailycheck
- Aufgabe1
- Aufgabe2
- Aufgabe3
|
Define data in
app.compontent.ts
Definitions Code in app.component.ts
import { Component } from '@angular/core';
import { AngularFireModule } from 'angularfire2';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
//--< Daten >--
title = 'dailycheck';
aufgaben=['Aufgabe1','Aufgabe2','Aufgabe3'];
//--</ Daten >--
constructor(af:AngularFireModule) {
console.log(af);
}
}
|
Datab Ads in app.compontent. html
Issuing code
in the .html
<h1>{{title}}</h1>
<ul>
<li *ngFor="let aufgabe of aufgaben">{{aufgabe}}</li>
</ul>
|