I am writing a directive with angularJs, with a simple below html template and a contorller as c
template:
<p>Input id : {{c.inputId()}}</p> <!--this is for test,correct value is shown-->
<input id="{{c.inputId()}}" type="text" />
but the problem is that even the <p> tag for test shows correct the value, the input id does not get the value.
I've tried these id="c.inputId()", id='c.inputId()', id="{{c.inputId()}}", id='{{c.inputId()}}', but none of them work.
Any ideas what is wrong with my code and how can I solve this???
EDIT 1
I think I is better to explain that documnet.getElementbyId returns null..maybe It was my mistake that I didn't mentioned it in order to make the question simple and I did not realize that documnet.getElementbyId returns null.
You should use
ng-attrto use interpolation in attributes, so in your caseng-attr-id="{{c.inputId()}}"