T
T
TekVanDo2014-06-11 14:31:46
JavaScript
TekVanDo, 2014-06-11 14:31:46

How to get dynamic url parts in $routeProvider

My data is loaded in resolve before the controller is launched, but I can’t get to the "parkingId" there. data appears in $route later. Tell me how you can do better (or even refuse to load data before the controller starts)?

$routeProvider.when('/parking/edit/:parkingId', {
        templateUrl: '/Content1/partials/newParking.html',
        resolve: {  parkingEditData: function ($location) {
                var idA = $location.$$path.split("/");
                parkingEditCtrlPr(idA[idA.length-1]);
            }
        }
    })

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
maxaon, 2014-06-11
@maxaon

Try ui-router. During resolve there is a $stateParams object that stores the state parameters.
And ui-router has become the de facto standard routing and state mechanism.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question