angular-route-segment icon indicating copy to clipboard operation
angular-route-segment copied to clipboard

Segment defaults do not pass to the segment controller and below

Open wingedfox opened this issue 11 years ago • 3 comments

When I navigate to the root segment with default sub-segment and pre-defined parameters I get

Error: Route param `what` is not specified for route `/browse/:what`

Segment:

.segment('browse', {
     default: true,
     dependencies: ['what'],
     templateUrl: 'views/list.html',
     controller: 'FileListCtrl',
     params: {what: 'root'}

Controller

.controller('FileListCtrl', [
    '$scope', '$routeSegment',
    function ($scope, $routeSegment) {
       $routeSegment.$routeParams.what; // undefined

Target url: http://host/browse

Yeah, I'll add a demo, but not right now. Anyway, the bug exists and it is easy reproducible.

wingedfox avatar Jun 30 '14 18:06 wingedfox

What is params? There are no such option in segment's config.

artch avatar Jun 30 '14 20:06 artch

Ok, as you say.

Anyway, it works that way: https://github.com/artch/angular-route-segment/blob/master/src/route-segment.js#L299

wingedfox avatar Jul 03 '14 15:07 wingedfox

This variable has nothing to do with segment's configuration object. It is for internal use and is not accessible from external consumers.

artch avatar Jul 03 '14 16:07 artch