javascript - How to pass string to a function inside a directive in AngularJS? -
this templating function custom directive have created. string str passed function obtaindynamicfield(str)
coming undefined. str string , not variable.
function gettemplate() { return ' <td>' + ' <div class="inner">' + ' <input type="text" ' + ' class="form-control" ' + ' data-dynamic-field="obtaindynamicfield(str)"'+ ' data-ng-model="formdata.product" >' + ' </input>' + ' </div>' + ' </td>' +
i struggling past 2-3 hours in this. think need escape out str unable think far on how achieve it. kindly suggest.
you need escape '
around string:
'data-dynamic-field="obtaindynamicfield(\'str\')"'
Comments
Post a Comment