Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

ng-click scoped function passing value

xiaix
Tera Guru

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:

find_real_file.png

The inspected element:

find_real_file.png

So what am I missing that the passed values show up perfectly when I inspect the page, but the values debugged are string literals??

1 ACCEPTED SOLUTION

Brad Tilton
ServiceNow Employee

Hi David,



You should just write those as JS like:



ng-click="openSiteInfo(data.userLocation, emergency.locationSysID)"


View solution in original post

6 REPLIES 6

Nevermind... I see it now.   Client script, line #14.       Should read:     $scope.data.Instance_URL



I brainfarted


mayurt
Tera Expert

Hello guys,



One question related to this widget i am using widget in service catalog and instead of any button in html template can i call the server script of the widget from on submit client script??





Thanks,
Mayur