dhoko / angular-ngBabelfish

Internationalization module for angular.js, it's magic !
MIT License
11 stars 3 forks source link

TypeError: Cannot read property '$$hashKey' of undefined #5

Closed dhoko closed 10 years ago

dhoko commented 10 years ago

If the page does'nt exist inside the translation it breaks.

cf inside babelfish

angular.extend(i18n.data[lang][page], i18n.data[lang]['_common']);

Error:

TypeError: Cannot read property '$$hashKey' of undefined
    at Object.extend (http://localhost:8080/build/js/vendor.min.js:426:14)
    at Object.setTranslation [as updateState] (http://localhost:8080/build/js/vendor.min.js:21640:25)
    at http://localhost:8080/build/js/vendor.min.js:21535:23
    at Scope.$broadcast (http://localhost:8080/build/js/vendor.min.js:12691:28)
    at v.transition.N.then.v.transition.v.transition (http://localhost:8080/build/js/vendor.min.js:21471:10417)
    at wrappedCallback (http://localhost:8080/build/js/vendor.min.js:11319:81)
    at http://localhost:8080/build/js/vendor.min.js:11405:26
    at Scope.$eval (http://localhost:8080/build/js/vendor.min.js:12412:28)
    at Scope.$digest (http://localhost:8080/build/js/vendor.min.js:12224:31)
    at Scope.$apply (http://localhost:8080/build/js/vendor.min.js:12516:24) vendor.min.js:9778
dhoko commented 10 years ago
angular.extend(i18n.data[lang][page], i18n.data[lang]['_common']);

if i18n.data[lang][page] is null or undefined it breaks. Must be an empty Object.