Q:

angularjs how to search in search in json object in html template

In Angularjs I am trying to search in json data which i am using in html template. My input json data is as below,
var data = JSON.parse(
            '{
                "Project": {
                    "_attributes": {
                        "gui": "ProjectGui",
                        "prjname": "MyProject"
                    },
                    "stringarr": [
                        {
                            "_attributes": {
                                "name": "Project.comments"
                            },
                            "_text": "MyComments"
                        },
                        {
                            "_attributes": {
                                "name": "Project.classpath"
                            },
                            "_text": "D:\\Project\\bin\\config.jar"
                        }
                    ]
                }
            }'
);

And i am using this for displaying and editing name in my html template, which is working fine. When I edit input box , it reflects the changes in json data as well, that's exactly I want.
Name: <input type="text" ng-model="data.Project._attributes.prjname"><br>

But I also want to display and edit comments in same way but not getting idea how to achieve this. The difference is, I have to search within json data where data.Project.stringProp[i]._attributes.name is "Project.comments" and take   "_text" as input for displaying & editing. I have tried following that is not working.
Comments: <input type="text" ng-repeat="x in data.Project.stringProp" ng-model="x">{{x._text}}<br>

Please suggest , what would be the best possible way to do this. I think it can be done using a get function and ng-change function but that approach will be lengthy and may put performance overheads.
Thanks

A:

You can either implement a filter for filter _text value if the name is 'Project.comments', or you can simply add an ng-if statement.
Comments: <input type="text" ng-repeat="x in data.Project.stringarr" ng-if="x._attributes.name == 'Project.comments'">{{x._text}}<br>

