0

I'm trying to get data from the link where I'm getting first name and last name. The code work just fine if I use one parameter that is #/firstName/{{firstName}} but when I try to add another parameter then it doesn't show anything. Please help.

My link in the template

<a href="#/firstName/{{firstName}}/lastName/{{lastName}}">Profile</a>

My Route Provider configuration

$routeProvider.
when('/firstName/:fn/lastName/:ln', {
    templateUrl: 'profile.php',
    controller: 'ProfileController'
})

My Controller

allControllers.controller('ProfileController', ['$scope', '$routeParams', function($scope, $routeParams) {
  $scope.firstName = $routeParams.fn;
  $scope.lastName = $routeParams.ln;
}]);

My View

Welcome, {{ firstName }} {{ lastName }}!
3
  • You can follow this link stackoverflow.com/questions/25896675/… Commented Feb 6, 2016 at 15:09
  • don't forget to inclide ngRouter module Commented Feb 6, 2016 at 15:17
  • should work fine. What is happening? Any errors? Create demo that replicates problem Commented Feb 6, 2016 at 16:34

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.