angular routing issue with custom mod folder

This is my routing code:

.when('/:mod/:page*/', {
      templateUrl: function($routeParams) {
          return 'pages/'+$routeParams.mod+'/' + $routeParams.page + '.html';
      }
})

if the url is

/users/add

it will load html from pages/users/add.html

Now the issue is Say for example I have a list page list.html with list data

id - name        - action
1  - John        - Edit

When I now click on edit I need to go to the edit.html page as well as I need to pass and get the id to that html.

How can this be achievable ? Do I need to edit my routing ?

NOTE: I am using ng-route for routing.

assume edit.html has a separate controller and the list.html has a separate controller.

Let me know if you need more info.

Answers


You can pass id in the edit link

...
<a href="/edit/{{id}}">Edit</a>

$routeProvider
.when('/edit/:id', {
  templateUrl: 'edit.html',
  controller: 'EditController',
....

app.controller('EditController', function($routeParams) {
    console.log($routeParams.id);
    ....
});

Need Your Help

Specifying Unit Test Location in Gradle

scala junit gradle scalatest

I've been getting my feet wet with Gradle for a school project (not an assignment) and I have this project that is divided into two folder, src/main/scala and src/test/scala.

Passing arguments to functions in Python using inspect

python reflection introspection inspect

I have a Python script which creates a dictionary of its own functions and I'd like it to execute them by reading in a function name and arguments using YARP (knowledge of YARP is irrelevant to this