"path" is a function exposed on $location service.

https://code.angularjs.org/1.3.10/docs/api/ng/service/$location

path([path]);

This method is getter / setter.

Return path of current url when called without any parameter.

Change path when called with parameter and return $location.

Note: Path should always begin with forward slash (/), this method will add 
the forward slash if it is missing.

// given url http://example.com/#/some/path?foo=bar&baz=xoxovar path = 
$location.path();// => "/some/path"



On Monday, January 26, 2015 at 11:06:50 PM UTC+5:30, Jim Bell wrote:
>
> Controller:
>
>
> app.controller('activitiesViewController', ['$scope', 'ActivitiesFactory', 
> '$location',
> function($scope, ActivitiesFactory, $location) {
>
>     function init () {
>         $scope.activities =  ActivitiesFactory.getAllWithCounts();
>     }
>
>         init();
>         $scope.loadDateController = function(id, count) {
>             $location.path = '/activities/showdates/' + id;
>         };
> }]);
>
> Routes:
>
> app.config(['$routeProvider', function($routeProvider){
>     $routeProvider
>
>         .when('/activities/showdates/:id', {
>             templateUrl : 'views/datesView.html',
>             controller  : 'datesViewController'
>         })
>
>         .otherwise({
>             redirectTo: '/'
>         });
> }]);
>
> The function "loadDateController" is executed by a button ng_click in the 
> html. The debugger show that the statement "$location.path = 
> '/activities/showdates/' + id;" is being executed.
>
> When the button is clicked, nothing happens. I looked a many examples on 
> the web and most of them show that this works. Obviously, I am doing 
> something that is wrong.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to