irfan shafi
irfan shafi

Reputation: 524

How to load a page on a button click

I have a very simple question i have a button on each row of uigrid , i know on the button click we are able to call a function, after calling some function i want to load some page from the function. here is the code of button which is on every row of ui-grid

$scope.gridOptions.columnDefs=[
{name: 'DETAILS', displayName: 'DETAILS',enableFiltering: false, cellTemplate:
'<button id="editBtn" type="button" class="btn-small" 
ng-click="getExternalScopes().edit(row.entity)" >SHOW DETAILS</button>'} ],
`

and here is the function which i am calling on the button click

$scope.myScope = {
 edit: function( row) {
  var sales_id=row.sales_id;
  alert("sales id is"+sales_id);
  //from here i want to load html page
 }` 

i want to save the passed parameter in some factory and then load some page so that i can be able to access that parameter for the later use

Upvotes: 0

Views: 2341

Answers (2)

Ved
Ved

Reputation: 12113

It is very simple. You can make a method like this.

$scope.loadPageMethod = function () {
$location.path('/your path');
or, window.location.url('path')
     }

Upvotes: 1

Hemadri
Hemadri

Reputation: 56

use ng-routes in your application and give the url of the page you want to load as a templateUrl. then add $location.path('/path'); in the function you are calling.

Upvotes: 2

Related Questions