parent
152d25a1e9
commit
bfb3197fcb
@ -1,11 +1,16 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { RouterLink } from '@angular/router';
|
import { LoginModalService } from '../../services/login-modal.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-home-page',
|
selector: 'app-home-page',
|
||||||
imports: [RouterLink],
|
|
||||||
templateUrl: './home-page.component.html',
|
templateUrl: './home-page.component.html',
|
||||||
})
|
})
|
||||||
export class HomePageComponent {
|
export class HomePageComponent {
|
||||||
currentYear = new Date().getFullYear();
|
currentYear = new Date().getFullYear();
|
||||||
|
|
||||||
|
constructor(private loginModalService: LoginModalService) {}
|
||||||
|
|
||||||
|
openLogin() {
|
||||||
|
this.loginModalService.openModal();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
import { TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { LoginModalService } from './login-modal.service';
|
||||||
|
|
||||||
|
describe('LoginModalService', () => {
|
||||||
|
let service: LoginModalService;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
TestBed.configureTestingModule({});
|
||||||
|
service = TestBed.inject(LoginModalService);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should be created', () => {
|
||||||
|
expect(service).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
@ -0,0 +1,17 @@
|
|||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { BehaviorSubject } from 'rxjs';
|
||||||
|
|
||||||
|
@Injectable({ providedIn: 'root' })
|
||||||
|
export class LoginModalService {
|
||||||
|
private showModalSubject = new BehaviorSubject<boolean>(false);
|
||||||
|
|
||||||
|
showModal$ = this.showModalSubject.asObservable();
|
||||||
|
|
||||||
|
openModal() {
|
||||||
|
this.showModalSubject.next(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
closeModal() {
|
||||||
|
this.showModalSubject.next(false);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue