- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2020 06:54 AM
Hello Experts,
I struggle with "ng-if" condition.
if it's NOT assigned to me, the button will be displayed.
HTML
<button type="button" class="btn btn-default" ng-click="c.uiAction('assign_to_me',current.sys_id)" ng-if="!current.user == current.assigned_to">Assign to Me</button>
Solved! Go to Solution.
- Labels:
-
Service Portal

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2020 06:58 AM
Hi there,
Assuming this is about the user and assigned_to fields like you mentioned in your example:
Can you try:
ng-if="current.user != current.assigned_to"
Because you do mention, not assigned to me, I would expect something with using gs.getUserID(). Can you verify?
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP
---
LinkedIn
Community article list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2021 05:41 AM
Hi all,
I tried this code to display the record if present else it has to display button but iam not getting button. Any assistance on this.
<div ng-if ="c.data.u_student.length != 0">
<h style='font-size:30px'> Dear {{c.data.u_student.stu}}, Welcome to student portal.</h>
<div class='row'>
<div class='col-md-4'>
<div class="card">
<div class="card-body">
<h5 class="card-title"style='font-size:25px'>Student</h5>
<h6 class="card-subtitle mb-2 text-muted">{{c.data.u_student.stu}}</h6>
<p class="card-text">This is student's card</p>
</div>
</div>
</div>
</div>
</div>
<br>
<div ng-if="c.data.u_student.length==0">
<button type='button' class='btn btn-primary' ng-click='submit()'>
submit
</button>
</div>