angular-route-segment
angular-route-segment copied to clipboard
Segment defaults do not pass to the segment controller and below
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.
What is params? There are no such option in segment's config.
Ok, as you say.
Anyway, it works that way: https://github.com/artch/angular-route-segment/blob/master/src/route-segment.js#L299
This variable has nothing to do with segment's configuration object. It is for internal use and is not accessible from external consumers.