0

I have the following jsfiddle code: http://jsfiddle.net/838SY/1/

My question is how can I make the following ng-click to set the isEditable only for the clicked entry and at the same time call the edit(object) method?

<span ng-click="flag == true||(isEditable=!isEditable)">

I've tried this:

<span ng-click="flag == true||(isEditable=!isEditable; edit(object))">

Doesn't work.

I've tried:

<span ng-click="flag == true||edit(object)">

and at the edit method level I defined :

$scope.isEditable=!$scope.isEditable; 

this approach will set the isEditable value for all the list elements, which is not what I want. I only want it set for the clicked element.

Any ideas?

Thanks.

2 Answers 2

1

You can use this sintax: flag == true? edit(object):false

Sign up to request clarification or add additional context in comments.

8 Comments

And how do I control the value of isEditable if I'm using this syntax? I'm hitting the same problem with this approach.
Thank but i believe you misunderstood my question. My initial example is doing exactly this.
What i need is something like this:
<span ng-click="flag == true?isEditable=!isEditable;edit(object):false">&nbsp;{{flag}}-{{object.text}}</span>
This will not be accepted by angular but I hope you can understand what i want to do
|
0
    <div ng-show="!isEditable">
       <input type="text" ng-model="object.text" ng-blur="isEditable!=isEditable;update(object);edit(object);" />
    </div>

This will call the multiple methods when the user get blurred from the text box.So, by this you can specify the multiple methods that need to be called on the blur event of the text box

1 Comment

My problem is with the <span ng-click="flag == true||(isEditable=!isEditable)">&nbsp;{{flag}}-{{object.text}}</span> not with the input tag.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.