For example:
In you app_route.js you have to link url pattern to a specific controller and the template to use for displaying datas:
angular.module('mapApp', []).
config(['$routeProvider', function($routeProvider){
$routeProvider.when('/foo/:bar', {templateUrl: './view/partial/template.html', controller: mapCtrl});
$routeProvider.otherwise({redirectTo: '/foo/01'});
}
]);
In your specific controller you add the logic (here select data by bar) :
Same using for $routeParams & $route.current.params
function mapCtrl($scope, $routeParams, $http) {
$http.get('./data/myDatas.json').success( function(data){
var arr = new Array();
for(var i=0; i < data.length; i++){
if(data[i].bar == $routeParams.bar){
arr.push(data[i]); }
}
$scope.items = arr;
});
}
mapCtrl.$inject = ['$scope', '$routeParams', '$http']; //for minified bug issue
And in your template.html, the layout :
<div ng-repeat="item in items">
<h3>{{item.bar}}</h3>
</div>
Don't forget add the ng-view on your index page where you want displaying datas, and ng-app="mapApp" in html tag.
I hope that will help you ^^
for more informations, see : http://docs.angularjs.org/tutorial/step_07
{{$route.current.params.bar}}
directly in view then it works. – Teammate