I am designing a platform for a site, where site users are allowed to execute scripts on JSON in browser window only
Here is a screen shot of page:

user will be getting the JSON, and whatever script is written in form will execute on JSON.
I am using AngularJS as my front end scripting tool. I know there are ways to execute script using JavaScript eval() funciton. Also another way to execute script is
function runMe() {
console.log('here you go');
}
var fnstring = "runMe";
var ex = window[fnstring];
ex.apply();
But I am looking for a better approach in JavaScript/AngularJS only. Is there any way through which I can extend my Angular Scope function dynamically. Or is there any other Object oriented approach, I should use in order to maintain the script execution safe and optimize.