mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-08-01 12:10:33 +00:00
reload $state when project changes
This commit is contained in:
parent
579222e148
commit
aec3fc32c3
1 changed files with 4 additions and 2 deletions
|
|
@ -151,10 +151,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
function handleProjectChange($rootScope, $localStorage, Projects) {
|
||||
function handleProjectChange($rootScope, $localStorage, Projects, $state) {
|
||||
// TODO refactor
|
||||
$rootScope.$watch('r.currentProject', (newCurrentProject, oldCurrentProject) => {
|
||||
if (newCurrentProject && newCurrentProject.id) {
|
||||
if (newCurrentProject && newCurrentProject.id && oldCurrentProject && oldCurrentProject.id !== newCurrentProject.id) {
|
||||
// when there is an old current project existing
|
||||
if (oldCurrentProject && oldCurrentProject.id) {
|
||||
// save all current project data in $localStorage.projects[oldProject]
|
||||
|
|
@ -174,6 +174,8 @@
|
|||
$rootScope.r[property] = $localStorage[property] = newCurrentProject.data[property];
|
||||
}
|
||||
}
|
||||
|
||||
$state.reload();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue