angularjs code changes do not show up after browser refresh

后端 未结 17 1549
北海茫月
北海茫月 2020-12-13 09:35

Any time, I make code changes in .hmtl file or the .js file, the browser still renders the old code and my new code changes don\'t show up in the browser result.

Fo

相关标签:
17条回答
  • 2020-12-13 10:21

    I simply deleted the dist folder in Visual Studio and it auto refreshed again.

    **** this was for Angular 7 ***

    0 讨论(0)
  • 2020-12-13 10:25

    You need to change the aspnetcore enviroment variable from production to development. From the official website:

    ... set an environment variable to tell ASP.NET to run in development mode:

    • If you’re using PowerShell in Windows, execute $Env:ASPNETCORE_ENVIRONMENT = "Development"
    • If you’re using cmd.exe in Windows, execute setx ASPNETCORE_ENVIRONMENT "Development", and then restart your command prompt to make the change take effect
    • If you’re using Mac/Linux, execute export ASPNETCORE_ENVIRONMENT=Development

    If you are in linux, you might have to do it as a superuser. i.e.

    sudo export ASPNETCORE_ENVIRONMENT=Development

    The value of the variable may revert back to Production after re-booting. If you want to work with several environments, I suggest you define them in the launchSettings.json file:

    {
          "iisSettings": {
          "windowsAuthentication": false,
          "anonymousAuthentication": true,
          "iisExpress": {
             "applicationUrl": "http://localhost:40088/",
             "sslPort": 0
          }
       },
         "profiles": {
           "IIS Express": {
              "commandName": "IISExpress",
              "launchBrowser": true,
              "environmentVariables": {
                  "ASPNETCORE_ENVIRONMENT": "Development"
              }
           },
           "IIS Express (Staging)": {
              "commandName": "IISExpress",
              "launchBrowser": true,
              "environmentVariables": {
              "ASPNETCORE_ENVIRONMENT": "Staging"
             }
           }
         }  
       }
    

    Read about environments here:

    0 讨论(0)
  • 2020-12-13 10:26

    I opened link in Incognito mode since in that mode cache is disabled and Voila it worked.

    0 讨论(0)
  • 2020-12-13 10:27

    For me, none of the previous answers worked. I was using Chrome, and the only way I was able to view the update was by opening an incognito window. My regular browser window, for some reason, just will not get the latest assets.

    I have tried clearing my cache, disabling cache on devtools, and hard refresh, to no avail. The only way I was able to fix it was by clearing the DNS cache. Here's a link with more details:

    How to Clear the DNS Cache on Computers and Web Browsers


    Using command line, here's how you go about doing it:

    Windows 7 & Earlier

    ipconfig /flushdns
    

    Windows 8

    ipconfig /flushdns
    

    OSX (Yosemite, El Capitain, and Sierra)

    sudo dscacheutil -flushcache
    sudo killall -HUP mDNSResponder
    
    0 讨论(0)
  • 2020-12-13 10:27

    You need to run command yarn webpack:build to recompile your client code. Otherwise modifications/updates in .HTML, .json, .ts files will not be reflected.

    0 讨论(0)
提交回复
热议问题