Zama Mohammed
Zama Mohammed

Reputation: 339

Textarea does not work in Angular but Input works fine

I am trying to create a directive for text area, where I can show the number of characters remaining and clear the whole text area, I don't know why it does not work for textarea, but it works fine with input.

Here is the plnkr link: http://plnkr.co/edit/VoGZgIwwbvR0mr7Rux69

I just don't understand what is the difference between the textarea and input in angular!! :(

<textarea ng-model="name" maxlength="200"></textarea>
<input type="text" ng-model="name" >
{{name}}

I can see that value is updating in all the three places, but when I click clear link, its not working for text area

Upvotes: 1

Views: 1225

Answers (1)

Mohammad Shahrouri
Mohammad Shahrouri

Reputation: 384

although i don't under stand why you want to modify the original textarea element, I've modified your link function check it here http://plnkr.co/edit/MUVdlRjcaD95hf3JjHEq

the forth parameter to link function is the controller.

Upvotes: 2

Related Questions