0

This is my JSON object response:

{
"senderdata": "123456789",
"senderName": "ifelse",
"message": "Hi",
"draftName": "empty"
}

I am displaying this in UI using ng-repeat:

I am getting this json response in $scope.drafts.

my code:

tr(ng-repeat='draft in drafts')
 td {{draft.draftName}}
 td {{draft.senderName}}
 td {{draft.message}}

But I need some condition,

if my draftName object key have string called "empty" I don't want to display data.

2 Answers 2

2

Juse use != condition with ng-if

tr(ng-repeat='draft in drafts' ng-if="draft.draftName !== 'empty'")
Sign up to request clarification or add additional context in comments.

1 Comment

Sorry if empty i dont want to display datas.
0

You can filter your ng-repeat by draft name to display items only when draftName is not empty

<div ng-repeat="item in data | filter:{ draftName: '!empty'}">
  {{item.senderName}}-{{item.senderdata}}-{{item.draftName}}
</div>

demo

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.