Javascript not being executed thru script

I’m trying to run some javascript code thru the “exec” command in my scripts on AngularJS DOM objects but the javascript is not being executed. If I run the javascript thru console then it does what I want it to but it won’t execute the javascript through the script. Has anyone faced this issue before?