- 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 04:48 AM
can you change in your server side script. isnted using item try with data.
<td ng-if="{{data.response_code}}=='300' "> <button id="btnIncident" name="submit" ng-click="c.remove(item.name)" type="submit">Remove</button></td>
</tr>
just give a try

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2018 04:01 AM
Hi Swathi,
Syntax is corret. I doubt you item.response_code is not having expected value and hence not rendering the markup.
Hope this helps.
Regards,
Ujjawal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2018 04:42 AM
Hi Ujjawal,
It is having proper value, 300.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2018 05:22 AM
Hi Swathi,
Can you paste your widget code. So that issue could be identified.
Regards
Ujjawal