src/app/shared/excel-password-modal/excel-password-modal.service.ts

Metadata

Index

Properties
Methods

Constructor

constructor()

Methods

close
close(password?: string)
Parameters :
Name Type Optional
password string Yes
Returns : void
Public open
open(openOptions?: OpenOptions)
Parameters :
Name Type Optional
openOptions OpenOptions Yes
Returns : Observable<Result>

Properties

Public optionsSubject$
Type : Subject<Options>
Default value : new Subject()
Public resultChange$
Type : Subject<Result>
Default value : new Subject()
import { Injectable } from '@angular/core'
import { Subject, Observable } from 'rxjs'
import { OpenOptions, Options } from './models/options.interface'
import { Result } from './models/result.interface'

@Injectable({
  providedIn: 'root'
})
export class ExcelPasswordModalService {
  public optionsSubject$: Subject<Options> = new Subject()
  public resultChange$: Subject<Result> = new Subject()

  constructor() {}

  public open(openOptions?: OpenOptions): Observable<Result> {
    this.optionsSubject$.next({
      open: true,
      ...openOptions
    })

    this.resultChange$ = new Subject<Result>()
    return this.resultChange$.asObservable()
  }

  close(password?: string) {
    this.optionsSubject$.next({
      open: false
    })

    this.resultChange$.next({
      password
    })
    this.resultChange$.complete()
  }
}

results matching ""

    No results matching ""