Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Define value in client script

YashikaG
Tera Contributor

Hello team, how can I define value in client script in Service Portal and how to show it in HTML?

1 ACCEPTED SOLUTION

amitshishod
Tera Guru
Hello @YashikaG ,
Use can use below code. It will work.
var c = this; 
$scope.val = "val1";
c.data.sndval = "val2";
 
HTML:
<p>
    {{c.data.sndval}}
  </p>
  <p>{{val}}</p>
<p ng-bind="data.sndval">
  
</p>
 
<p ng-bind="val">
  
</p>

Please mark my response correct and helpful, if it helps you.
Please reply if any issue happens.

View solution in original post

5 REPLIES 5

PritamG
Mega Guru

Client Script:

$scope.myValue = "Hello, Service Portal!";

HTML:

<h1>{{ myValue }}</h1>