ng-web-apis icon indicating copy to clipboard operation
ng-web-apis copied to clipboard

[BUG] Storage not working

Open sysmat opened this issue 1 year ago • 0 comments

🐞 Bug report

Description

  • project demo is broken
  • I try from example but not working

Reproduction

"@ng-web-apis/common": "^2.1.0",
"@ng-web-apis/geolocation": "^2.0.0",
"@ng-web-apis/storage": "^1.0.0",

@Component({
  selector: 'app-web-api',
  standalone: true,
  imports: [CommonModule],
  template: `
    <p>
      web-api works!
    </p>
    <div *ngIf="geolocation$ | async as position">
      <span>{{position.coords.latitude}}</span>
    </div>
    <div>
      BUG: Value from storage not working
      <code *ngIf="value$ | async as store">STORAGE_EVENT: {{ store }}</code>
    </div>

  `,
  styles: [
  ]
})
export class WebApiComponent {

  readonly geolocation$ = inject(GeolocationService);
  readonly value$ = this.event$.pipe(filterByKey('tomaz'), toValue());

  constructor(
    @Inject(STORAGE_EVENT) private readonly event$: Observable<StorageEvent>,
    @Inject(LOCAL_STORAGE) private readonly storage: Storage,
    @Inject(StorageService) private readonly storageService: Storage) {}

}

Expected behavior

  • to see value from storage

Versions

  • OS: Windows
  • Browser chrome
  • Angular: 16

Additional context

sysmat avatar Jun 13 '23 09:06 sysmat