Angular: Empty Fiddle

http://angularjs.org/

by Donal Devine

HTML

<script src="http://code.angularjs.org/angular-1.0.1.js"></script>
<div ng-controller="MyCtrl"> 
 <a href="#/test?id=1">Link 1</a>
 <a href="#/test?id=2">Link 2</a>
    <h1>{{id}}</h1>
    <div ng-view></div>    
</div>
<script type="text/ng-template" id="test.html">
    Routing Test    
</script>

JavaScript

var myApp = angular.module('myApp', []);


myApp.config(['$routeProvider', function ($routeProvider) {
    $routeProvider.when("/test", {
        templateUrl: "test.html",
        controller: "testCtrl",
        reloadOnSearch: false
    });
}]);

function MyCtrl($scope) {
}

function testCtrl($scope, $location) {
    alert("reloading controller with id: " + $location.search().id);
}