The Zurich release has arrived! Interested in new features and functionalities? Click here for more

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
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