Hot reloading for Angular 1.x controllers, services and templates, using livereload.js
This plugin allows reloading parts of your Angular 1.x application while developing, without needing to trigger a full page reload. It was inspired by angular-hot-reloader. I needed something similar, but without the Webpack dependency.
bower install angular-hot-livereload-plugin --save-dev
- Load the plugin script next to livereload.js in your development workflow
For this plugin to work a few things should be kept in mind:
-
Your application should use the Angular 1.5+ component-based application architecture
-
(File)names used should be predictable:
-
lorem-ipsum.component.js
:angular.module('...').component('loremIpsum', { controller: LoremIpsumController, templateUrl: '/some/path/lorem-ipsum.template.html' }); function LoremIpsumController() { ... }
-
lorem-ipsum.template.html
-
lorem-ipsum.service.js
:angular.module('...').service(LoremIpsum.name, LoremIpsum); function LoremIpsum() { ... }
-
-
Some kind of LiveReload server is needed, for example grunt-contrib-watch