this is login i want get email with two way databinding
...
export class LoginComponent implements OnInit {
author ={
email:'',
password:''
}
constructor(private _auth: AuthService, private router: Router) { }
ngOnInit(): void {
}
token : any;
login(){
let sendEmail = this.author.email
this._auth.setemail(sendEmail);
console.log(sendEmail);
this is service i get nothing when i console in getemail
...
@Injectable({
providedIn: 'root'
})
export class AuthService {
serEmail= ''
setemail(data: string) {
this.serEmail= data;
console.log(this.serEmail);
}
getemail() {
let data = this.serEmail
console.log(data);
return data;
}
...
andi this is header where i want get this data
...
export class HeaderComponent implements OnInit {
data2: any
id: any
recEmail:any;
constructor(public _auth: AuthService) { }
ngOnInit(): void {
this.recEmail = this._auth.getemail();
console.log(this.recEmail);
...
help me to get data from login to header