I've got a directive that manipulate DOM, and than a 3rd party script:
// manipulate DOM
var elButton = angular.element('<button></button>');
element.append(elButton);
// 3rd party-service that is to manipulate elButton again.
externalService.do(attrs.someAttr);
Angular seems to digest my changes only after externalService.do() is happening, so externalService has no chance to do his magic.
Is there any way to force angular to apply its changes to the view? $apply and $digest throw an error, $timeout of 500ms solved the problem in my fast machine, but fail to do that in slower machines, and anyway I want to avoid using timeout.
The 3rd party service I use is Optimizely (A/B testing service). I didn't find any resource that solves this problem.
Thanks!