I am making a test table from a class created. Current class should generate a table of available data in my html file. But I do not see anything generated.
I am using Angular 5.
Expected table:
type1 Car
type2 Plane
type3 Truck
Component File:
import { Component, OnInit } from '@angular/core';
import { mService } from '../Dash/Dash.service';
import { m } from '../Dash/Dash.model;
@Component({
selector: 'app-m',
templateUrl: './m.component.html',
styleUrls: ['./m.component.css'],
providers: [mService]
})
export class mComponent implements OnInit {
mServ: m[]
constructor(private _mService: mService) {
}
ngOnInit() {
this.mServ= this._mService.GetData(true);
}
}
Service file
import { Injectable } from '@angular/core';
import { m } from '.Dash.model;
@Injectable()
export class mService {
//sourc - not currently in use
GetData(sour: boolean): m{
var viewModel = new m();
view.wheels= [
"Car", "Plane", "Truck"
];
view.type= [
"type1", "type2", "type3"
];
return view;
}
constructor() { }
}
Model file
import { Injectable } from '@angular/core';
@Injectable()
export class m{
public wheels: Array<string>;
public type: Array<string>;
constructor() { }
}
HTML
<table>
<tbody>
<tr *ngFor='let mServ&& mServ.length'>
<td>{{ mServ.wheels}}</td>
<td>{{ mServ.type}}</td>
</tbody>
</table>