Using AngularJS Values in JavaScript Function -
i have function calls code using jcrop api takes in values set aspect ratio. however, need values come data connection i'm using angular. need this:
<img src="sample.jpg" onclick="setaspectratio({{valuetoset}});" />
but this error when trying way. if way:
<img src="sample.jpg" ng-click="setaspectratio({{valuetoset}});" />
then valuetoset
evaluates, can't call way setaspectratio()
isn't defined in controller (it's script on page itself). because uses jcrop , didn't want mix jcrop angular controller.
how can accomplish i'm trying here?
you don't need {{}} around variable name. ng-click=setaspectratio(valuetoset) should work.
Comments
Post a Comment