Service Portal: Javascript in HTML Widget

warciech
Mega Contributor

Hi,

Is it possible to use Javascript in the stock HTML widget? 

I am trying to create a hyperlink in text that would take users back one page and I was thinking to use Javascript for that purpose (history.back()), but whenever I put that in the HTML, it gets formatted out and doesn't work.

Perhaps there is a better way to achieve that?

6 REPLIES 6

SanjivMeher
Kilo Patron
Kilo Patron

In Service Portal HTML, you should call the function and then in client controller define the function.

 

HTML should be

 

 <a href="javascript:void(0)" ng-click="previousPage()">Back</a>

 

Inside client controller, use

$scope.previousPage = function(){
window.history.back();
}


Please mark this response as correct or helpful if it assisted you with your question.

Ran into something similar and Sanjiv's solution worked like a charm!