Fahad
Fahad

Reputation: 1444

Angular JS add new row in editable mode

I am creating a grid using the ng-repeat directive. I need to be able to edit inline, which I achieved using the same idea provided here. I now also need to be able to add new rows to this grid on click of a button. I am doing this by pushing a new entry to my collection on each button click, which inserts a new row into my grid. I want this new row to get added in editable mode. However, to do that, I need to be able to set the editMode property to true dynamically while pushing the new row. How can I achieve this?

JSFiddle: http://jsfiddle.net/Thw8n/69/

Upvotes: 2

Views: 1968

Answers (2)

Amaranadh Meda
Amaranadh Meda

Reputation: 724

if i understand your problem in right way the following will be answer .

Just replace editMode with enty.editMode in your html handlebars.

I was applied this solution to the your jsfiddle it is working fine for me.

Upvotes: 2

EvAlex
EvAlex

Reputation: 2938

You did everything right, except binding to editMode field. Just change

data-ng-show="editMode"

to

data-ng-show="entry.editMode"

Upvotes: 5

Related Questions