Migrated the commit to localstorage for happen when the $routeChangeStart event is fired