
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-03-2016 10:42 AM
Well this seems a bit odd...
HTML Template (the important info)
<tr ng-repeat="emergency in data.emergencies" id="{{::emergency.locationSysID}}">
<td ng-if="::data.userLocation == emergency.locationSysID">
<a ng-click="openSiteInfo('{{::data.userLocation}}', '{{emergency.locationSysID}}')">Test Link</a>
</td>
</tr>
Client Script (the important info)
function($scope)
{
$scope.openSiteInfo = function(val, userLocationSysID)
{
console.debug("val: " + val);
console.debug("userLocationSysID: " + userLocationSysID);
};
}
The debug log:
The inspected element:
So what am I missing that the passed values show up perfectly when I inspect the page, but the values debugged are string literals??
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-03-2016 11:40 AM
Hi David,
You should just write those as JS like:
ng-click="openSiteInfo(data.userLocation, emergency.locationSysID)"

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-03-2016 11:40 AM
Hi David,
You should just write those as JS like:
ng-click="openSiteInfo(data.userLocation, emergency.locationSysID)"

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-03-2016 11:58 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-03-2016 12:02 PM
Hi David,
Could you post the full html, client script and server portion so we can debug?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2016 04:05 AM
Sure thing, thanks for asking:
HTML Template:
<div ng-if="::data.bcpEmergency">
<table id="bcp_news_gadget" cellspacing="0" cellpadding="0" align="center" style="border: none; width: 700px; padding-bottom: 10px;">
<tr>
<td class="emergencyBorder" colspan="2" style="text-align:center; color:white; float:center; width:700px; ">
<span>
<strong>* Site Emergency Information *</strong>
</span>
</td>
</tr>
<tr ng-repeat="emergency in data.emergencies" id="{{::emergency.locationSysID}}">
<td>
<table style="margin: auto;">
<tr class="locationsBorder">
<td ng-if="::data.userLocation != emergency.locationSysID">
[{{::emergency.location}}]
</td>
<td ng-if="::data.userLocation == emergency.locationSysID">
<a ng-click="openSiteInfo(data.userLocation, emergency.locationSysID)">[{{::emergency.location}}]</a>
</td>
<td ng-if="::emergency.checkinRequired == '1'">
<button ng-if="::data.userLocation == emergency.locationSysID">
Check In
</button>
</td>
<td style="width:70%; text-align:justify;padding-left:5px;">
{{::emergency.alertMessage}}
</td>
</tr>
</table>
</td>
</table>
</div>
Client Script:
function($scope)
{
$scope.openSiteInfo = function(val, userLocationSysID)
{
console.debug("val: " + val);
console.debug("userLocationSysID: " + userLocationSysID);
if (val != userLocationSysID)
{
alert("You can only view BCP information for your own site.");
}
else
{
var URL = data.Instance_URL;
window.location.assign(URL + "checkin");
}
};
}
Server Script:
(function() {
var userID = gs.getUserID();
var userLocation = gs.getUser().getLocation();
var Instance_URL = gs.getProperty('glide.servlet.uri');
data.bcpEmergency = false;
data.emergencies = [];
data.userLocation = userLocation;
data.userID = userID;
data.Instance_URL = Instance_URL;
var bcp = new GlideRecord('u_bcp_site_emergencies');
bcp.addNotNullQuery('u_alert_message');
bcp.addQuery('u_active', true);
bcp.query();
while (bcp.next())
{
data.bcpEmergency = true;
var listData = {};
listData.location = bcp.getDisplayValue('u_location').toString().trim();
listData.locationSysID = bcp.getValue('u_location').toString().trim();
listData.checkinRequired = bcp.getValue('u_employee_checkin_required').toString().toLowerCase();
listData.alertMessage = bcp.getValue('u_alert_message').toString().trim();
data.emergencies.push(listData);
}
})();