0

My code is like this

<body ng-app="">
<div ng-init="friends = [{name:'John', phone:'555-1276'},
                       {name:'Mary', phone:'800-BIG-MARY'},
                       {name:'Mike', phone:'555-4321'},
                       {name:'Adam', phone:'555-5678'},
                       {name:'Julie', phone:'555-8765'},
                       {name:'Juliette', phone:'555-5678'}]"></div>Name only
<input ng-model="search.name">
<br>
    <h3>Results</h3>
<table id="searchObjResults">
    <tr>
        <th>Name</th>
        <th>Phone</th>
    </tr>
    <tr ng-repeat="friendObj in friends | filter:search:strict">
     name:   <input ng-model="friendObj.name" />
        <td>{{friendObj.name}}</td>
         <td>{{friendObj.phone}}</td>
    </tr>
</table>

when any search happens I want to bind result data to an input box I provided. Filtering happpens correctly, but i am not able to bind it to my input. it correctly binds to a <td> though. Fiddle Can any one tell me what I am doing wrong here?

2
  • Chandermani is correct with tr and td: jsfiddle.net/eyugb3fw/1 Commented Oct 13, 2014 at 6:42
  • @LearningNeverStops I have to wait 2 more minutes to mark it as correct answer. I am helpless ;) Commented Oct 13, 2014 at 6:44

1 Answer 1

1

Your input should be inside one of the td i think. See this fiddle

http://jsfiddle.net/u08xucsj/

Remember tr can only have td

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

Comments

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.