简体   繁体   中英

Angular new changes not reflecting

I am building a new project using angularjs and PHP(codeigniter). I am facing an issue with the content or changes I make on both client-and serverside, but the changes are not being reflected.

Does this have something to do with the cache?

The browser uses template caching, which should be cleared upon making changes to templates. See this question . You can do the following to make your life easier when developing:

Reload the page with clearing cache each time you need to update your app

Yet a more convenient way is to:

Disable cache in developer tools

Eg for Chrome

CTRL+SHIF+J and on the network tab check 'Disable Cache'

Yet may be better still to:

Remove template cache in your application

This is done via $templateCache.remove()

More info on preventing template caching

Try this if you are also having issue with Angular default change detection mechanism. In my case, in my ionic4 Project default change mechanism of Angular was somewhat not working properly so I triggered it manually.

constructor(private ref: ChangeDetectorRef) {
    ref.detach();
    setInterval(() => {
        this.ref.detectChanges();
    }, 500);
 }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM