Kiloumap
Kiloumap

Reputation: 2243

Replace button by div for modify

I got a new question for you.

I have 2

First one is in case when their are no description : it's a button. On click that show an textarea for write the description.

Second one is in case when their are a description, that show the field and modify input.

And I got a button for apply.

I did that with

<div ng-show = "description != ''">{{Description}}</div>

<div ng-show = "description == ''">
    <textarea></textarea>
</div>

My problem is when I write the first character inside of my textarea, the input disapear and my description appears, and i can't write anything else before to apply my description.

Can I fix it so that the ng-show work when I press my apply button ?

Keep in mind, i'm begginer with angular. Don't judge me :p

Thanks guys

Upvotes: 0

Views: 27

Answers (2)

Krishna_32
Krishna_32

Reputation: 175

you should maintain 2 divs. 1st div is enable for true and 2nd div as false after clickable event you enable 2nd div as true and 1st div as false.

Upvotes: 0

Jelle den Burger
Jelle den Burger

Reputation: 1468

Guessing that you have an ng-model somewhere, you can use ng-model-options="{ updateOn: 'blur' }", meaning the value will be updated when you leave the textarea, and not while you're typing.

Upvotes: 1

Related Questions