$location.url should not refresh the page

Vikram3
Giga Guru

Hi All,

Below HTML will be added in left nav as shown

<div>
  <label class="container" ng-repeat="task in data.iterativeTasks">
    <div class="result-id">
      <p>Project Id:</p>
    
    <div class="result" ng-click='c.AddManualTask(task.catalog_id)'>{{task.name}}</div>
      </div><br>
    <div class="result-id">
      <p>Created on:</p>
    </div>
    <div class="result">{{task.catalog_id}}</div>
    <input type="radio" checked="checked" name="radio">
    <span class="checkmark"></span>
  </label>
</div>

find_real_file.png

On click of Project Id it will go to another URL,

function($location) {  /* widget controller */  var c = this;
					 
					 c.AddManualTask = function(catalogID)
						{
						 $location.url('snappi?id=fr_plan_details&sys_id='+catalogID+'&mode=new&dynamic=false&snappi_id='+c.data.snappiId+'+&phase_id='+c.data.phaseId);
						}
					}

After click the page is getting refreshed and becomes like this,

find_real_file.png

On the whole, subcategories are closed. My question is, how to stop refreshing the page after changing the URL.

Thanks in advance.

1 ACCEPTED SOLUTION

Jon Barnes
Kilo Sage

if you aren't changing portals, just try using this:

$location.search({
  id: 'fr_plan_details',
  sys_id: catalogID,
  mode: 'new',
  dynamic: 'false',
  snappi_id: c.data.snappiId,
  phase_id: c.data.phaseId
});

View solution in original post

9 REPLIES 9

Jon Barnes
Kilo Sage

if you aren't changing portals, just try using this:

$location.search({
  id: 'fr_plan_details',
  sys_id: catalogID,
  mode: 'new',
  dynamic: 'false',
  snappi_id: c.data.snappiId,
  phase_id: c.data.phaseId
});

Nope. It is not working as expected Jon. I am getting the same results. Thanks.

you may also need to add spa=1 to your url

Thanks Jon. It is working.