Skip to content

Instantly share code, notes, and snippets.

@labidiaymen
Created June 10, 2022 13:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save labidiaymen/20ceddab8dbf00204621cd5c3e12f146 to your computer and use it in GitHub Desktop.
Save labidiaymen/20ceddab8dbf00204621cd5c3e12f146 to your computer and use it in GitHub Desktop.
import { Component, OnInit } from '@angular/core';
import { UserService } from './user.service';
@Component({
standalone: true, // <- declare component as standalone
selector: 'app-user-detail',
providers: [UserService], // <- provide te user service directly inside the component
templateUrl: './user-detail.component.html',
styleUrls: ['./user-detail.component.css'],
})
export class UserDetailComponent implements OnInit {
user: any;
constructor(private userService: UserService) {}
ngOnInit() {
this.user = this.userService.userProfile();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment