ng-optimizely icon indicating copy to clipboard operation
ng-optimizely copied to clipboard

Difficult to Access Optimizely Data Object

Open alexjohnson505 opened this issue 9 years ago • 1 comments

As per the Optimizely JS API users may sometimes wish to access the Optimizely Data Object.

data-object

This object can be tricky to load within Angular's scope. I'm currently able to load the object from the callback on loadProject

promise = optimizely.loadProject(id);
promise.then(function(resp){
   var projectSettings = resp;
});

While it's possible to do manually, it might be nice to have method on this directive for returning the current project's data object? If the project isn't loaded yet, it could return a promise. For example:

optimizely.projectSettings();

// or

promise = optimizely.projectSettings();
promise.then(function(resp){
   var projectSettings = resp;
})

Thanks for creating ng-optimizely!

alexjohnson505 avatar Jul 30 '15 19:07 alexjohnson505

This sounds pretty do-able. Would you care to submit a pull request with your proposed changes and relevant documentation? I can take it on myself but it might be a little bit before I can start the work.

jacopotarantino avatar Jul 30 '15 20:07 jacopotarantino