I'm using google closure to compress my code but I have a problem with the following line of code:
eval('this.find(\''+ element_to_append_the_controller+ '\').'+controller_to_load+'(options_for_controller)');
I have to use eval because the method (controller_to_load
) I have to execute on the element is variable and depend on the params I get.
My Problem is that I have to pass an object to that method, so I'm doing that as an String representation of the variable name(options_for_controller
), but closure will change that name and won't change the variable name in my eval string.
My solutions would be:
- getting the variable name dynamic as string
- parsing object (with callback functions) to string
- disable compressing for these line of codes
But how can I do one of them or is there another solution?
Thanks