Advertisement
Guest User

Untitled

a guest
Jan 20th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. LanguagesEvent($rootScope, LANG_EVENTS) {
  2. return {
  3. changeLanguage: function changeLanguage(langKey) {
  4. $rootScope.$emit(LANG_EVENTS.changeLanguage,langKey);
  5. },
  6. onChangeLanguage: function onChangeLanguage(scope, handler) {
  7. var deRegistration = $rootScope.$on(LANG_EVENTS.changeLanguage, function(event, langKey) {
  8. handler(langKey);
  9. });
  10. scope.$on('$destroy', function() {
  11. deRegistration();
  12. });
  13. return deRegistration;
  14. }
  15. };
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement