i18next / ng-i18next

translation for AngularJS using i18next
https://github.com/i18next/ng-i18next
MIT License
161 stars 54 forks source link

$digest already in progress #15

Closed julien51 closed 11 years ago

julien51 commented 11 years ago

With http://subtome.com we're seeing an odd error:

Error: $digest already in progress
    at Error (<anonymous>)
    at g (https://www.subtome.com/js/angular.min.js:84:377)
    at Object.e.$apply (https://www.subtome.com/js/angular.min.js:88:437)
    at setTranslation (https://www.subtome.com/js/ng-i18next.js:1:326)
    at https://www.subtome.com/js/ng-i18next.js:2:41
    at https://www.subtome.com/js/i18next.js:49:70
    at https://www.subtome.com/js/i18next.js:108:154
    at String.<anonymous> (https://www.subtome.com/js/i18next.js:109:20)
    at Object._each [as each] (https://www.subtome.com/js/i18next.js:17:430)
    at Object.sync._loadLocal (https://www.subtome.com/js/i18next.js:108:369) 

Any idea what that means? Something like https://github.com/BinaryMuse/ngInfiniteScroll/blob/master/build/ng-infinite-scroll.js#L36-L40 may fix it?

bugwelle commented 11 years ago

Yes, I got this error a few times, too :( I thought I had fixed that...

It means that Angular is already checking whether variables have been changed.

I'm using $digest to "force" ng-i18next to use the $scope variables in the translation. This means without using $digest

<p ng-i18next="helloScope"></p>

would be

<p>Hello {{name}}!</p>

instead of

<p>Hello Julien!</p>

until something in the scope changes...

I'm sorry that this happens. I'll look into this, later ;)

And thanks for the link to ng-infinite-scroll. :+1: I am still learning Angular and hope that these bugs will get fixed soon :)

Regards, Andre

bugwelle commented 11 years ago

Please let me know if it's still not working :)

julien51 commented 11 years ago

Thanks Andre! That's much better :)

Julien