What is the most conventional way to make an AngularJS single page app automatically reload in the browser every time I change its code?
In other words, if I have a code editor open editing the HTML for the AnguarJS single page app, and a browser at that app, side-by-side on the same screen, hitting Save in my editor should instantly trigger the browser to refresh.
Alternatively, same scenario as above except instead of hitting Save on my editor, I did a Commit in my VCS.
Use Grunjs watch task for this.
That is the work of your task runner like gulp or grunt to watch the changes over specified files and perform action. None of this is related to angularjs
Related
We are developing a React.js PWA.Is it possible to programmatically close application after gets update to apply them?And how?Is there another solution for it??
You can not close the application, you are not allowed to close the tab opened by the user. Only tabs that have been opened with a code can be closed with a code.
This is your problem with killing Application in RAM(app cleaner).
This will clear the cache of the previous version of the application and replace it with the new main.chunk.js.
I have a solution that you can update the program without closing it, for doing this you can use the "clear-cache" React library.
close application after gets update to apply them
This in case of a web application would be killing the caches and refreshing the browser tab.
You can kill caches by applying something like versoning/time stamps/unique id etc to the resource URLs, so that on refresh browser detects them as a new resource that needs to be downloaded.
You can force refresh the app using location.reload();
I am new in AngularJS and studying about routing. As i have created a demo application and it is working fine but the issue is whenever i click on the anchor tag it loads the required document 'x.html', once loaded in the ngView next time same content is shown but it should show new content as 'x.html' is dynamic page which shows the date Time from server.
There is no more hits to the server. How can i make changes to the app.config so that it shows new content every time. Is it against the SPA as it will take more time to load the things again.
I think, it might not be an issue with router or angular. Can you pls post the code you are writing to display dynamic time and date?
I'm trying to develop my first Angular application, however quite often, when I change the source files, the app isn't updating.
I am using Firefox and the Xampp stack. If I change, for example, a view or even a controller, when I refresh my page, I am not seeing the updated changes. I just opened Chrome and it is showing the updated changes.
Is there some sort of caching going on, or any gotchas that I should know about?
Keep your dev-tools open, right-click on the refresh icon, and click 'empty cache and hard reload'. That should do it.
I want to create an angularjs app but each time it requires to press the refresh button in the browser to get the update. thus it bring to this question:
Is there any way to get live update while writing angularjs app? So I don't need to press the refresh button each time I make changes in my angularjs app.
Yes, you can use grunt which is a task runner written in node, grunt has a plugin called grunt-contrib-livereload that reloads the page whenever there are changes in the files/directories that you want to watch. Alternatively, there's a scaffolding tool for client side web applications in AngularJS called yeoman, that has a generator called generator-angular - this generator has an opinionated structure towards AngularJS application development and it comes with a basic setup that you can use for livereloading code changes from any files that you have configured to watch.
Start using yeoman. It has grunt that will solve yr problem plus lots of more exciting stuff.
Check this quick start guide : http://yeoman.io/learning/
I use the open source editor Brackets.io by Adobe. Just click the lightning icon button to the right of the editor to run your web page and will auto refresh for every save.
You can do this in many ways. Many of the options are already mentioned in this post. All of them are workable. In my experience the most simplistic way to do this by the following way.No configuration , No setting , No need to code anything.
Just add this line in your <head> </head> tag of the html file
<script src="http://livejs.com/live.js"></script>
I need to alter another developer's theme, currently installed on Drupal 7. I need to change simple css, but cannot get the css to update. I have changed literally every reference to a particular #id in the css throughout the entire codebase, yet the chrome web inspector shows me those files as if they had never been changed.
Things I've tried:
Clearing the cache
Disabling/re-enabling the theme
Restarting apache
Violently shaking fists
Yet I cannot, for the life of me, get that css file to change in the downloaded file.
Try this:
Check the code of the HTML of your Drupal page.
Locate your CSS file in the code and open it in the browser.
Press F5 to refresh your browser cache.
Check if the file reflects your changes.
If not, you are editing the wrong file.
Remember that clearing CSS caches will append a different string to every CSS every time, so, if you are editing the correct file it must reflect the changes.
In the worst case you have issues with CSS :/