2 Replies Latest reply on Sep 25, 2017 2:22 PM by Roger Palmen

    AngularJS "ng-click" no update


      I am a new-bee in angularJS programming.

      I created an application that fetches the snapshotvalues from 10 Integer points from the PI-Archive. The page loads with the 10 snapshot values but whatever I try, the refresh button to does not work like I expect.

      It is all pretty straitforward and standard code, see attachments...


      What I found out that it has todo with the cached-data: when de debugger in IE-browser is activate I get updates when i pudh the refresh button: Apparently the browser disables the cache.

      Another is when I add a timestamp to the webApiCall then I get also data, see code snippet. THis tricks Angular because the URL is everytime different.



          piWebApiHttpServiceFactory.getSnapshotValue = function (webId) {


              return $http.get(serviceBase + 'streams/' + webId + '/value?t=' + Date()).then(function (response) {

                  return response; 




      My conclusion is that AngularJS does not get new data when the URL is not changed. But even when the URL does not change I want a refresh because the data can be changed.

      My question is: How to force Angular to get always the data, even when the url does not change...


      Attached: 3 application files.

        • Re: AngularJS "ng-click" no update

          Hi Hans,


          The first thing I would do is confirm that it's a definitely a caching issue and not something else at play.  Do other browsers exhibit the same behavior? Could you check the Network tab in the Developer Tools on page reload to confirm that there is no communication with your PI Web API server?


          If you find it is a caching issue, there is an config option for $http called 'cache' that you can set to false.  I'm not sure if this will fix the issue but it's worth a try.

          1 of 1 people found this helpful
          • Re: AngularJS "ng-click" no update
            Roger Palmen

            Angular is quite agressive in caching. To bypass that in Chrome, keep the developer tab open (F12), and be sure that on the Network tab you checked "Disable cache".

            1 of 1 people found this helpful