Skip to content

Instantly share code, notes, and snippets.

@blogcacanid
Created November 9, 2020 22:02
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 blogcacanid/8edac19289b0c80460a761ff31391b7e to your computer and use it in GitHub Desktop.
Save blogcacanid/8edac19289b0c80460a761ff31391b7e to your computer and use it in GitHub Desktop.
home.component.ts Authentication JWT Angular 9 Lumen 7
import { Component, OnInit } from '@angular/core';
import { UserService } from '../_services/user.service';
@Component({
selector: 'app-home',
templateUrl: './home.component.html',
styleUrls: ['./home.component.css']
})
export class HomeComponent implements OnInit {
content: string;
constructor(private userService: UserService) { }
ngOnInit(): void {
this.userService.getPublicContent().subscribe(
data => {
this.content = data;
},
err => {
this.content = JSON.parse(err.error).message;
}
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment