Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static files not being served when running app with 'ng serve' #6329

Closed
TylerJBrown192 opened this issue May 15, 2017 · 3 comments
Closed

Static files not being served when running app with 'ng serve' #6329

TylerJBrown192 opened this issue May 15, 2017 · 3 comments

Comments

@TylerJBrown192
Copy link

TylerJBrown192 commented May 15, 2017

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Versions.

$ ng --version
@angular/cli: 1.0.1
node: 6.9.1
os: win32 x64
@angular/common: 4.1.0
@angular/compiler: 4.1.0
@angular/core: 4.1.0
@angular/forms: 4.1.0
@angular/http: 4.1.0
@angular/platform-browser: 4.1.0
@angular/platform-browser-dynamic: 4.1.0
@angular/router: 4.1.0
@angular/cli: 1.0.1
@angular/compiler-cli: 4.1.0

Repro steps.

  1. Add a .txt or .json file anywhere in the project
  2. Add another in /src/assets/
  3. Run ng serve from the command line in the Angular application
  4. Open up the dev console and look for the files in the Sources tab OR set up a service to make a HTTP request to the file path you expect the static file to be at
  5. A 404 will occur

The log given by the failure.

N/A

Desired functionality.

Would like to be able to access static files within the Angular application.

Mention any other details that might be useful.

When building out an Angular v2 application (when Angular CLI was still in beta release) I was able to serve static text files inside of my /app directory and get them with Http.get('app/example-dir/test-file.json') from @angular/http

@9034725985
Copy link

have you tried --no-aot?

I have a similar bug.

I think it is related to #4806

here is my commit. I deploy to firebase and I have to do --no-aot to get the desired result
betternode/fakenews@7cb097a

I was hoping <img src="assets/1232015064656.jpg" alt="jesus"> would work with --aot true I think this is a bug somewhere

@sumitarora
Copy link
Contributor

Duplicate of #6158

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants