user2828442
user2828442

Reputation: 2515

Angular2 browser cache

Brief description: I am trying to handle the cache issue for an angular app on browser. I don't want my client to clear cache every time I update it.

So I have followed this tutorial

Problem: In my home.ts , I am making my

templateUrl: 'home.html',

to

templateUrl: 'home.html?v=1.0',

Then it gives me a 404 error.

What is wrong? I want to give version number to my home.html page.

Upvotes: 0

Views: 243

Answers (1)

user4676340
user4676340

Reputation:

Cache bustin is handled by the CLI.

Simply run your command with

ng build --prod

And the cache busting will take effect.

You can also set up a custom parameter in your angular.json config, but since it changes depending on your Angular version, I'm going to ask you your Angualr version first.

And also, the error is popping because your file is called home.html, not home.html?v=1.0. You're not handling URLS in your decorators, you're telling the compiler what files to open (and convert to JS).

Upvotes: 1

Related Questions