I want change the url in my angularjs app on the fly by tipping in a inputfield.
e.g.
- I stay on:
http://localhost/test/year/2012 - I will change on the side via a input field the year to 2013 that call my yearIsChanged function, than the url should changed to
http://localhost/test/year/2013 - But with my current configuration the url is changed to
http://localhost/test/year/2012/?year=2013
My modul configuration.
var module = angular.module('exampleApp').
config(['$routeProvider', function ($routeProvider) {
$routeProvider.
when('/test/year/:year', {templateUrl: 'partials/test.html', controller: OverviewCtrl, reloadOnSearch: false}).
otherwise({redirectTo: '/'});
}]);
Controller action:
function OverviewCtrl($scope,$routeParams, $location) {
$scope.yearIsChanged = function () {
$location.search('year', $scope.year);
}
}