Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

angularjs code changes do not show up after browser refresh

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.

For example, I add the following 2 lines of code in .html file.

    <div class="control-group">         <label class="control-label">First Name</label>         <div class="controls readonly">             {{profile.FirstName}}         </div>     </div>      <div class="control-group">         <label class="control-label">Last Name</label>         <div class="controls readonly">             {{profile.LastName}}         </div>     </div> 

Then I do the following:

  1. In VS2013, right click on my project and view in browser (IE or Chrome).
  2. Login to my application.
  3. Go the respective page and I see the rendering of the old html file. I do not see the newly added 2 div elements rendered at all.
  4. I even hit f5 to refresh the browser but still no luck.

What am I doing wrong?

like image 881
dotnet-practitioner Avatar asked Feb 04 '15 00:02

dotnet-practitioner


People also ask

Why angular changes not reflecting in browser?

the changes doesn't reflect in browser. You need to restart the application to reflect the changes.

Is angular code visible in browser?

Unlike PHP, Angular is a frontend framework. All frontend code is visible to the end user. All network calls are also visible to the end user, even if it's encrypted with HTTPS.

What is new in AngularJS?

One Way Data Binding However, in AngularJS 1.5+, there is a new one-way data binding that we can explore and also use to improve the performance of our AngularJS applications. A new syntax expression for the one-way data binding is the use of < notation. For two-way data bindings, the = notation is used instead.


2 Answers

Hit F12 in your browser to bring up the Developer Tools. Disable the Cache. Reload your page.

like image 103
Phil Degenhardt Avatar answered Oct 01 '22 01:10

Phil Degenhardt


Besides using Dev Tools to make sure the cache is disabled, you can edit your Web.config file and tell IIS to not cache your Angular files:

<configuration>    <!-- Disable IIS caching for directories containing Angular templates and scripts -->   <location path="app">     <system.webServer>       <staticContent>         <clientCache cacheControlMode="DisableCache"/>       </staticContent>     </system.webServer>   </location>  ... </configuration> 

My Angular root directory is app/. You may need to modify according to your file structure.

like image 43
Nate Barbettini Avatar answered Oct 01 '22 03:10

Nate Barbettini