r/angularjs • • Feb 25 '17

npm http-server keeps caching my AngularJS changes

I'm learning AngularJS 1.x. I'm using npm http-server to run the project locally.

The problem is, whenever I make changes to App.js the change doesn't get reflected on the site. I try refreshing the page, it doesn't update the changes to JS. I also tried serving with http-server -o -c-1 and still it doesn't refresh the cache.

The only thing that makes the App.js update is clearing the browser cache. How should I be doing this?

0 Upvotes

14 comments sorted by

View all comments

1

u/AshleyKang Feb 25 '17

Just found a better alternative to http-server.

npm install live-server -g

Then

<path> live server

No caching, and the site updates as soon as I save any file changes.

-2

u/Recoil42 Feb 25 '17

Any reason you're learning Angular 1.x over Angular2/4?

4

u/dejanribic Feb 26 '17

It is so much easier to learn...

0

u/AshleyKang Feb 26 '17

You mean Angular 2/4?

2

u/dejanribic Feb 26 '17

Nah, 1.x

1

u/Recoil42 Feb 26 '17

Disagree.