$ routeParams.value is undefined when switching to the new controller


I'm trying to pass a value from one controller to another. Using $routeParams as the method for doing this.

My main app references:

var app = angular.module('acnApp', ['ngResource', 'ngRoute'])

To pass the value:

    //GO TO EDIT
$scope.getOrgDetails = function (orgId) {
    $location.path('/network_org/edit/' + orgId)

In my routes.js:

        $routeProvider.when('/network_org/edit/:acnId', {
        templateUrl: 'Pages/acn/orgs/network_org_edit.html',
        controller: 'orgUpdateController'

On the receiving controller:

app.controller('orgUpdateController', ['$scope', '$location', '$routeParams',  function ($scope, $location, $routeParams) {

When I run this, the console result is "undefined"

Any help appreciated.

Try the method "url" rather than "path". like this :

$location.url('/network_org/edit?orgId=' + orgId)