Here is your component, with a timeout to simulate an async process to get 
some user data :
import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-mycomponent',
  templateUrl: './mycomponent.component.html',
  styleUrls: ['./mycomponent.component.css']
})
export class MycomponentComponent implements OnInit {

  customer: any;

  constructor() { }

  ngOnInit() {

    setTimeout(()=> {
      this.customer = {
        name: 'Bob',
        age: 25
      }
    }, 1000);

  }
}


And here is the HTML template of your component :
<p>
  mycomponent works!
</p>
<ul>
  <li>name : {{customer?.name}}</li>
  <li>Age : {{customer?.age}}</li>
</ul>


You need nothing else.

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/angular/966324b7-94a3-4abd-8a74-f572e7952b3b%40googlegroups.com.

Reply via email to