Skip to content

Fixes hot reloading via systemjs-hot-reloader#291

Merged
ocombe merged 1 commit intoocombe:masterfrom
circlingthesun:fix-system-js-hot-reload
Sep 5, 2016
Merged

Fixes hot reloading via systemjs-hot-reloader#291
ocombe merged 1 commit intoocombe:masterfrom
circlingthesun:fix-system-js-hot-reload

Conversation

@circlingthesun
Copy link
Contributor

JSPM/SystemJS allows for hot module reloads via https://github.com/capaj/systemjs-hot-reloader. To get angular to see any module changes angular needs to be bootstrapped again. This can be achieved by save a copy of the original bootstrapped element before bootstrapping occurred. The current bootstrapped element then needs to be removed and replaced with another copy of the original. Once a fresh element is in place, angular.bootstrap can be called again and all changes should show.

When using ocLazyLoad to wire up modules loaded by JSPM this approach doesn't work. The reason is that ocLazyLoad keeps track of what angular modules have already been loaded and prevents them from being loaded again. This PR resets this state every time angular is bootstrapped so that modules will be wired up again after bootstrapping angular for a 2nd time.

@kination
Copy link
Collaborator

kination commented Sep 5, 2016

+1 It looks good. How do you think @ocombe? Test/examples are running clearly.

@ocombe ocombe merged commit 17c0885 into ocombe:master Sep 5, 2016
@ocombe
Copy link
Owner

ocombe commented Sep 5, 2016

yes, it won't hurt anything anyway :)

@ocombe
Copy link
Owner

ocombe commented Feb 3, 2017

I just released 1.1.0 with this, I think I did it right, I haven't published a new version on this repo for ages, let me know if it works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants