Redplane
Redplane

Reputation: 3151

Textarea has redundant spaces after binding with AngularJS model

I'm using angularjs for making an SPA.

After clicking the OK button, my object will be serialized into a JSON string and be displayed inside a textarea control.

Here is my code:

But finally, I've got this :

Redundant spaces after binding with AngularJs

I got redundant spaces inside my textarea.

Can anyone help me to solve this problem?

I'm using

Upvotes: 0

Views: 361

Answers (1)

mgilson
mgilson

Reputation: 309929

You have extra whitespace inside the textarea:

<textarea class="form-control"
    readonly="readonly"
    rows="10">{{serializedInfo}}</textarea>

With that said, you're probably better off with an ng-model

<textarea class="form-control"
        readonly="readonly"
        rows="10"
        ng-model="serializedInfo"></textarea>

Upvotes: 1

Related Questions