Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2025 11:10 PM
Hello team, how can I define value in client script in Service Portal and how to show it in HTML?
Solved! Go to Solution.
1 ACCEPTED SOLUTION
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-26-2025 09:12 PM
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.
Please mark my response correct and helpful, if it helps you.
Please reply if any issue happens.
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-26-2025 09:12 PM
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.
Please mark my response correct and helpful, if it helps you.
Please reply if any issue happens.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-26-2025 09:56 PM
Steps to Follow:
Define Value in Client Script
- Use $scope to define and set a value in your client script.
- Example:
function($scope) { $scope.message = "Hello, Service Portal!"; }
Show Value in HTML
- Use AngularJS expressions ({{ }}) to display the value in the HTML template.
- Example:
<div> {{message}} </div>
Full Example:
Client Script
function($scope) { // Set the value $scope.greeting = "Welcome to the Service Portal!"; }
HTML Template
<div> <h2>{{greeting}}</h2> </div>