0
$location.url('?filterBy='+web.websiteId);

In this code add params after my url but it also add # before ?filterBy=

Like

www.asasa.com/asas#?filterBy=1

but i need like this

www.asasa.com/asas?filterBy=1

I am using angularjs 1.2.17

Himanshu Bhuyan
  • 306
  • 2
  • 8
  • 20

1 Answers1

0

I think you require some data on other state/controller. First of all this is a traditional method. The more proper way would be to RESTful approach when setting up the routes, like

.when('/asas', ...)
.when('/asas/:filterBy', ...)

and when changing the location you can do

$location.path( "/asas" );
$location.path( "/asas/1" );
V31
  • 7,626
  • 3
  • 26
  • 44
  • Is there no option to remove hash before params ? – Himanshu Bhuyan Aug 13 '14 at 17:28
  • 1
    You can use $locationProvider.html5Mode(true) in order to avoid # in your urls. This line need to be in your app config function – V31 Aug 13 '14 at 17:33
  • var app = angular.module('onlinedeals', []); app.controller('onlineCtrl', function ($scope, $http, $window,$location) { $http({method: 'GET', url: '/asasa/dfdfd/asa'}).success(function(data) { $scope.website = data.websites; $scope.onlinedata = data.coupons; This is my app – Himanshu Bhuyan Aug 13 '14 at 18:19
  • http://stackoverflow.com/questions/18214835/angularjs-how-to-enable-locationprovider-html5mode-with-deeplinking – V31 Aug 13 '14 at 18:22
  • the question has a code in which there is a section app.config you can make use of that – V31 Aug 13 '14 at 18:22
  • When i add app.config(function($locationProvider) { $locationProvider.html5Mode(true); }); then it working find but in ie8 it redirect to home page – Himanshu Bhuyan Aug 14 '14 at 08:47
  • I think there is a problem with IE<9 with HTML 5 there is good documentation how to enable it in angular and otherwise http://www.paulund.co.uk/turn-on-html5-in-ie8-or-lower – V31 Aug 14 '14 at 09:08