Navigate to one widget to another Service Portal

DB1
Tera Contributor

Hello All, 

I am looking for help with the following request.

I have displayed some list of CIs using the following code in a widget

But whenever a record is selected out of the list I want that to redirect to a new Widget (on click of the record).

How to acheive that?

Window url is not going to work. how to make it work on selection of the record from the list

find_real_file.png

<div class="panel panel-primary">  
  <div class="panel-heading">
  <h1 class="bg-primary">Client CIs  
  </h1>
</div>
  <ul class="list-group result-container">
    <li ng-repeat="inc in data.incident" ng-model = "c.fname" ng-click="c.openPopUp">
      <a href>{{inc.ci}}</a>
        
    </li>
  </ul>
  </div>
 
<!--<sp-widget widget="data.example"></sp-widget> --
(function() {
	/* populate the 'data' object */
	/* e.g., data.table = $sp.getValue('table'); */
data.incident=[];
data.user = gs.getUserID();
	var gruser_list = new GlideRecord('cmdb_rel_person');
	gruser_list.addQuery('user',data.user);
	gruser_list.query();
	var results = [];
	while(gruser_list.next())
	{
		var inc = {};
		//inc.user = gruser_list.getDisplayValue('user');
		inc.ci = gruser_list.getDisplayValue('ci');
		data.incident.push(inc);
	}

//data.example = $sp.getWidget('demo', {});
})();

I have a widget to display some set of CIs

function($scope, $rootScope){
	var c = this;
	c.test = function()
	{
		c.data.tempname = c.fname;
		var test = c.data.tempname;
		alert(test);
		$rootScope.$broadcast('xyz',test);//key - value function
	//data.example = $sp.getWidget('demo', {});
		c.openPopUp = function() {
var url = gs.getProperty() +"/sp";
var popup = window.open (url, "popup", "width=900, height=600");
}
	}
}

 

 

1 ACCEPTED SOLUTION

you need to replace the ng-click to below.You missed the paranthesis 

ng-click="c.openPopUp()"

View solution in original post

6 REPLIES 6

you need to replace the ng-click to below.You missed the paranthesis 

ng-click="c.openPopUp()"

My bad, It worked! thanks much!