We're running Optimizely on our Angular.js single page app. According to the documentation the best way to trigger the experiment is using conditional activation with a callback.
However, the code doesn't seem to run the experiment successfully as window.angular.element('body').scope()
would return undefined
The way I understand it is that the main Optimizely script in HTML would call the activation function immediately on load and register a callback. At this point, the page itself might not be fully loaded and all the Angular variables (such as scope
) not initialized, hence the undefined
error which causes nothing to be registered on $locationChangeSuccess
.
Anyone have experience dealing with this issue? What am I doing wrong here?
Thanks!