- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-24-2018 03:38 AM
Hi All,
<td ng-if="item.response_code == '300'"> <button id="btnIncident" name="submit" ng-click="c.remove(item.name)" type="submit">Remove</button></td>
</tr>
The above line is not working as expected, Remove button is not visible all time, irrespective of response code.And it is visible and working as expected if i remove 'ng-if="item.response_code == '300'"'.
How to compare the item.response_code value?
Thanks & Regards,
Swathi.
Solved! Go to Solution.
- Labels:
-
Service Portal Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-24-2018 07:19 AM
I forget sometimes how javascript works. This should do the trick:
item.response_code === '300'
Depending upon the situation javascript interprets '300' and 300 as being equal or the same. Whereas if you use the equality where it checks the type as well then it will prove to be actually an integer vs a string version of 300.
But to answer your other question how to compare without ng-if:
Simply place the expression in the markup:
<div> {{ item.response_code === '300' }} </div>
That syntax is what is doing the comparison. ngIf is just looking for a result.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-24-2018 07:19 AM
I forget sometimes how javascript works. This should do the trick:
item.response_code === '300'
Depending upon the situation javascript interprets '300' and 300 as being equal or the same. Whereas if you use the equality where it checks the type as well then it will prove to be actually an integer vs a string version of 300.
But to answer your other question how to compare without ng-if:
Simply place the expression in the markup:
<div> {{ item.response_code === '300' }} </div>
That syntax is what is doing the comparison. ngIf is just looking for a result.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-24-2018 03:53 AM
Try
<td ng-if="item.response_code == 300">
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-24-2018 04:41 AM
Hi Vignesh,
I tried it, no luck

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-24-2018 03:55 AM
are you getting item.response_code from the server?
<td ng-if="{{item.response_code}}== 300"> <button id="btnIncident" name="submit" ng-click="c.remove(item.name)" type="submit">Remove</button></td>
</tr>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-24-2018 04:41 AM
Yes Harshvardan.