Geeks With Blogs
Deeksha Sharma
<!DOCTYPE html>
<html lang="en">
    <title>AngularJS Routes example</title>
    <script src=""></script>
    <script src=""></script>

<body ng-app="sampleApp">

<a href="#/route1/abcd">Route 1 + param</a><br/>
<a href="#/route2/1234">Route 2 + param</a><br/>

<div ng-view></div>

    var module = angular.module("sampleApp", ['ngRoute']);

        function($routeProvider) {
                    when('/route1/:param', {
                        templateUrl: 'angular-route-template-1.jsp',
                        controller: 'RouteController'
                    when('/route2/:param', {
                        templateUrl: 'angular-route-template-2.jsp',
                        controller: 'RouteController'
                        redirectTo: '/'

    module.controller("RouteController", function($scope, $routeParams) {
        $scope.param = $routeParams.param;

This way you can get param from the route. 

Posted on Monday, October 20, 2014 6:18 AM | Back to top

Comments on this post: Angularjs param

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Deeksha Sharma | Powered by: