Angular Multi-repo Micro-Apps: Sharing Singleton services
With reference to the apps we already have set up, Disclaimer: This is just to demonstrate a shared state. Not to be used in an ideal login/logout scenario. The best way to handle login/logouts are to use httpOnly cookies that use a token in BFF layer Let's say we we want to handle user's authentication create a folder, i am calling it "shared-library" cd shared-library ng new shared-library --create-application=false ng generate library KavyaMyUserServiceLibrary (cant use too generic names, it will not allow for public publish) Inside shared-library\shared-library\projects\user-service-library\src\lib\user-service-library.service.ts import { Injectable } from '@angular/core' ; import { BehaviorSubject } from 'rxjs' ; @ Injectable ({ providedIn : 'root' }) export class UserServiceLibraryService { constructor () { } private loggedIn = new BehaviorSubject < boolean >( false ); loggedIn$ = this . loggedIn . asObservable...