amit
amit

Reputation: 1209

If else condition not working in angularjs

I am new in angularjs, I am getting employment status and i just want if i am getting employement status equal to HALFTIME then PartTime text should be display,Here is my code but not working,showing me nothing,where i am wrong ?

<h2 ng-if="{{myprofile.myJobs[0].employmentType}}==HALFTIME">
Part Time
</h2>

Upvotes: 1

Views: 111

Answers (2)

Harun Or Rashid
Harun Or Rashid

Reputation: 5947

You don't have to use interpolation {{ var }}.

<h2 ng-if="myprofile.myJobs[0].employmentType == HALFTIME ">
    Part Time
</h2>

Upvotes: 2

Bill P
Bill P

Reputation: 3618

This is the correct syntax:

<h2 ng-if="myprofile.myJobs[0].employmentType == 'HALFTIME'">
    Part Time
</h2>

You don't need curly braces inside ng-if

Upvotes: 4

Related Questions