Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

httpResource.blob not working well #61113

Copy link
Copy link
Closed
@sysmat

Description

@sysmat
Issue body actions

Which @angular/* package(s) are the source of the bug?

common

Is this a regression?

Yes

Description

  1. when backend return http status 500 isLoading signal is still true and error is false
  2. if I want to save Blob with file-saver I need to use effect

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

UX is not shownig what should

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 19.2.10
Node: 22.15.0
Package Manager: npm 10.9.2
OS: win32 x64

Angular: 19.2.9
... animations, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, router, service-worker

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1902.10
@angular-devkit/build-angular   19.2.10
@angular-devkit/core            19.2.10
@angular-devkit/schematics      19.2.10
@angular/cli                    19.2.10
@schematics/angular             19.2.10
rxjs                            7.8.2
typescript                      5.8.3
zone.js                         0.15.0

Anything else?

  • example to save a Blob with effect
readonly excelResource = httpResource.blob(() =>
    this.#queryParams()
      ? {
          url: `${apiPaths.statistics}/3/k?${this.#queryParams()}`,
          reportProgress: true,
        }
      : undefined
  );

readonly #ef = effect(() => {
    if (this.excelResource.progress()) {
      if (this.excelResource.progress().loaded === this.excelResource.progress().total) {
        saveAs(this.excelResource.value(), 'statistikaMax3.xlsx');
        this.#queryParams.set(null);
      }
    }
  });

onSubmit3Months(_f: NgForm) {
    // trigger download excel
    this.#queryParams.set(
      buildUrlParams({
        fromDate: this.fromDate.getTime(),
        toDate: this.toDate.getTime(),
      })
    );
  }
  • example where not working save Blob
readonly excelResource = httpResource.blob(() =>
    this.#queryParams()
      ? {
          url: `${apiPaths.statistics}/3/k?${this.#queryParams()}`,
          reportProgress: true,
        }
      : undefined
  );

onSubmit3Months(_f: NgForm) {
    // trigger download excel
    this.#queryParams.set(
      buildUrlParams({
        fromDate: this.fromDate.getTime(),
        toDate: this.toDate.getTime(),
      })
    );

   if (this.excelResource.progress()) {
      if (this.excelResource.progress().loaded === this.excelResource.progress().total) {
        saveAs(this.excelResource.value(), 'statistikaMax3.xlsx');
        this.#queryParams.set(null);
      }
    }


  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: commonIssues related to APIs in the @angular/common packageIssues related to APIs in the @angular/common packagecore: reactivityWork related to fine-grained reactivity in the core frameworkWork related to fine-grained reactivity in the core frameworkcross-cutting: resourceIssues related to the newly introduced resource / httpResourceIssues related to the newly introduced resource / httpResourcecross-cutting: signals

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.