Sentenza
Sentenza

Reputation: 1259

Serving a file download in a AngularJS html5mode express environment

I'm trying to serve a pdf file download on a app essentially generated with the angular-fullstack yeoman generator.

In app.js html5mode is set to true.

I tried building a download link using an tag and href but just nothing happens. Watching network activity reveals, that it's not generating an get request.

Server backend is an express server serving partials and other stuff.

How can i do this ?

Upvotes: 1

Views: 896

Answers (1)

fian
fian

Reputation: 770

Why not put the file download link on the subdomain like file.domain.com?

This example might be help you to set up subdomain in your express application.

EDIT:

Just put target="_self" on your link.

Example: <a href="/link/to/file" target="_self">link</a>

Source: Conditionally have anchor links send user to a different page, rather than load to ng-view

Upvotes: 1

Related Questions