rawls238 / PlanOut.js

A JavaScript port of Facebook's PlanOut Experimentation Framework
MIT License
308 stars 52 forks source link

inputs is undefined #66

Closed kasual1 closed 6 years ago

kasual1 commented 6 years ago

Hey guys,

for a project at my university I need to implement PlanOut. Since my web app runs on angular (v.5.0.0) I try to use PlanOut.js to integrate it into my project, but It seems like I'm missing something.

When I extend my class MyExperiment from Experiment it does not seem to override the constructor properly. When I try to create an experiment like this:

var exp = new MyExperiment({userId: 12 });
this.btnText =  exp.get('foo');

it tells me, that the constructor of MyExperiment should be empty instead of containing e.g. the userId

I can't figure out how to pass this input value (e.g. userId) to the super class.

I'm fairly new to angular and javascript in general so please don't be too condemning ;) I'm also aware that you guys actually created PlanOut.js to work well with React, but I thought since it is a javascript library it also should run on angular as well.

When I fake the userId in the MyExperiment class I'm able to log the event just fine. If you want me to explain things in more detail, just let me know!

kasual1 commented 6 years ago

Figured out how to do it. Thanks for your effort. Great library!