rails-angularjs2 2.0.0.pre.alpha.28 → 2.0.0.pre.alpha.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/rails-angularjs2/version.rb +1 -1
- data/vendor/assets/javascripts/angular2.dev.js +5626 -5160
- data/vendor/assets/javascripts/angular2.js +5626 -5160
- data/vendor/assets/javascripts/angular2.min.js +16 -16
- data/vendor/assets/javascripts/angular2.sfx.dev.js +6151 -5509
- data/vendor/assets/javascripts/router.dev.js +417 -239
- data/vendor/assets/javascripts/router.dev.js.map +1 -1
- metadata +2 -2
@@ -4,17 +4,19 @@ System.register("angular2/src/router/instruction", ["angular2/src/facade/collect
|
|
4
4
|
var __moduleName = "angular2/src/router/instruction";
|
5
5
|
var StringMapWrapper,
|
6
6
|
isPresent,
|
7
|
+
isBlank,
|
7
8
|
normalizeBlank,
|
8
9
|
RouteParams,
|
9
10
|
Instruction;
|
10
11
|
function shouldReuseComponent(instr1, instr2) {
|
11
|
-
return instr1.component == instr2.component && StringMapWrapper.equals(instr1.params, instr2.params);
|
12
|
+
return instr1.component == instr2.component && StringMapWrapper.equals(instr1.params(), instr2.params());
|
12
13
|
}
|
13
14
|
return {
|
14
15
|
setters: [function($__m) {
|
15
16
|
StringMapWrapper = $__m.StringMapWrapper;
|
16
17
|
}, function($__m) {
|
17
18
|
isPresent = $__m.isPresent;
|
19
|
+
isBlank = $__m.isBlank;
|
18
20
|
normalizeBlank = $__m.normalizeBlank;
|
19
21
|
}],
|
20
22
|
execute: function() {
|
@@ -28,17 +30,15 @@ System.register("angular2/src/router/instruction", ["angular2/src/facade/collect
|
|
28
30
|
}());
|
29
31
|
$__export("RouteParams", RouteParams);
|
30
32
|
Instruction = (function() {
|
31
|
-
function Instruction() {
|
32
|
-
var
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
parentSpecificity = $__1.parentSpecificity;
|
33
|
+
function Instruction(component, capturedUrl, _recognizer) {
|
34
|
+
var child = arguments[3] !== (void 0) ? arguments[3] : null;
|
35
|
+
this.component = component;
|
36
|
+
this.capturedUrl = capturedUrl;
|
37
|
+
this._recognizer = _recognizer;
|
38
|
+
this.child = child;
|
38
39
|
this.reuse = false;
|
39
|
-
this.
|
40
|
-
this.
|
41
|
-
this.specificity = parentSpecificity;
|
40
|
+
this.accumulatedUrl = capturedUrl;
|
41
|
+
this.specificity = _recognizer.specificity;
|
42
42
|
if (isPresent(child)) {
|
43
43
|
this.child = child;
|
44
44
|
this.specificity += child.specificity;
|
@@ -46,13 +46,15 @@ System.register("angular2/src/router/instruction", ["angular2/src/facade/collect
|
|
46
46
|
if (isPresent(childUrl)) {
|
47
47
|
this.accumulatedUrl += childUrl;
|
48
48
|
}
|
49
|
-
} else {
|
50
|
-
this.child = null;
|
51
49
|
}
|
52
|
-
this.component = component;
|
53
|
-
this.params = params;
|
54
50
|
}
|
55
51
|
return ($traceurRuntime.createClass)(Instruction, {
|
52
|
+
params: function() {
|
53
|
+
if (isBlank(this._params)) {
|
54
|
+
this._params = this._recognizer.parseParams(this.capturedUrl);
|
55
|
+
}
|
56
|
+
return this._params;
|
57
|
+
},
|
56
58
|
hasChild: function() {
|
57
59
|
return isPresent(this.child);
|
58
60
|
},
|
@@ -134,6 +136,62 @@ System.register("angular2/src/router/url", ["angular2/src/facade/lang"], functio
|
|
134
136
|
};
|
135
137
|
});
|
136
138
|
|
139
|
+
System.register("angular2/src/router/async_route_handler", ["angular2/src/facade/lang"], function($__export) {
|
140
|
+
"use strict";
|
141
|
+
var __moduleName = "angular2/src/router/async_route_handler";
|
142
|
+
var isPresent,
|
143
|
+
AsyncRouteHandler;
|
144
|
+
return {
|
145
|
+
setters: [function($__m) {
|
146
|
+
isPresent = $__m.isPresent;
|
147
|
+
}],
|
148
|
+
execute: function() {
|
149
|
+
AsyncRouteHandler = (function() {
|
150
|
+
function AsyncRouteHandler(_loader) {
|
151
|
+
this._loader = _loader;
|
152
|
+
this._resolvedComponent = null;
|
153
|
+
}
|
154
|
+
return ($traceurRuntime.createClass)(AsyncRouteHandler, {resolveComponentType: function() {
|
155
|
+
var $__0 = this;
|
156
|
+
if (isPresent(this._resolvedComponent)) {
|
157
|
+
return this._resolvedComponent;
|
158
|
+
}
|
159
|
+
return this._resolvedComponent = this._loader().then((function(componentType) {
|
160
|
+
$__0.componentType = componentType;
|
161
|
+
return componentType;
|
162
|
+
}));
|
163
|
+
}}, {});
|
164
|
+
}());
|
165
|
+
$__export("AsyncRouteHandler", AsyncRouteHandler);
|
166
|
+
}
|
167
|
+
};
|
168
|
+
});
|
169
|
+
|
170
|
+
System.register("angular2/src/router/sync_route_handler", ["angular2/src/facade/async"], function($__export) {
|
171
|
+
"use strict";
|
172
|
+
var __moduleName = "angular2/src/router/sync_route_handler";
|
173
|
+
var PromiseWrapper,
|
174
|
+
SyncRouteHandler;
|
175
|
+
return {
|
176
|
+
setters: [function($__m) {
|
177
|
+
PromiseWrapper = $__m.PromiseWrapper;
|
178
|
+
}],
|
179
|
+
execute: function() {
|
180
|
+
SyncRouteHandler = (function() {
|
181
|
+
function SyncRouteHandler(componentType) {
|
182
|
+
this.componentType = componentType;
|
183
|
+
this._resolvedComponent = null;
|
184
|
+
this._resolvedComponent = PromiseWrapper.resolve(componentType);
|
185
|
+
}
|
186
|
+
return ($traceurRuntime.createClass)(SyncRouteHandler, {resolveComponentType: function() {
|
187
|
+
return this._resolvedComponent;
|
188
|
+
}}, {});
|
189
|
+
}());
|
190
|
+
$__export("SyncRouteHandler", SyncRouteHandler);
|
191
|
+
}
|
192
|
+
};
|
193
|
+
});
|
194
|
+
|
137
195
|
System.register("angular2/src/router/route_config_impl", ["angular2/src/facade/lang"], function($__export) {
|
138
196
|
"use strict";
|
139
197
|
var __moduleName = "angular2/src/router/route_config_impl";
|
@@ -324,38 +382,63 @@ System.register("angular2/src/router/html5_location_strategy", ["angular2/src/do
|
|
324
382
|
};
|
325
383
|
});
|
326
384
|
|
327
|
-
System.register("angular2/src/router/pipeline", ["angular2/src/facade/async"], function($__export) {
|
385
|
+
System.register("angular2/src/router/pipeline", ["angular2/src/facade/async", "angular2/di"], function($__export) {
|
328
386
|
"use strict";
|
329
387
|
var __moduleName = "angular2/src/router/pipeline";
|
330
|
-
var
|
388
|
+
var __decorate,
|
389
|
+
__metadata,
|
390
|
+
PromiseWrapper,
|
391
|
+
Injectable,
|
331
392
|
Pipeline;
|
332
393
|
return {
|
333
394
|
setters: [function($__m) {
|
334
395
|
PromiseWrapper = $__m.PromiseWrapper;
|
396
|
+
}, function($__m) {
|
397
|
+
Injectable = $__m.Injectable;
|
335
398
|
}],
|
336
399
|
execute: function() {
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
400
|
+
__decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
|
401
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
402
|
+
return Reflect.decorate(decorators, target, key, desc);
|
403
|
+
switch (arguments.length) {
|
404
|
+
case 2:
|
405
|
+
return decorators.reduceRight(function(o, d) {
|
406
|
+
return (d && d(o)) || o;
|
407
|
+
}, target);
|
408
|
+
case 3:
|
409
|
+
return decorators.reduceRight(function(o, d) {
|
410
|
+
return (d && d(target, key)), void 0;
|
411
|
+
}, void 0);
|
412
|
+
case 4:
|
413
|
+
return decorators.reduceRight(function(o, d) {
|
414
|
+
return (d && d(target, key, o)) || o;
|
415
|
+
}, desc);
|
342
416
|
}
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
417
|
+
};
|
418
|
+
__metadata = (this && this.__metadata) || function(k, v) {
|
419
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
420
|
+
return Reflect.metadata(k, v);
|
421
|
+
};
|
422
|
+
Pipeline = (($traceurRuntime.createClass)(function() {
|
423
|
+
this.steps = [(function(instruction) {
|
424
|
+
return instruction.router.activateOutlets(instruction);
|
425
|
+
})];
|
426
|
+
}, {process: function(instruction) {
|
427
|
+
var steps = this.steps,
|
428
|
+
currentStep = 0;
|
429
|
+
function processOne() {
|
430
|
+
var result = arguments[0] !== (void 0) ? arguments[0] : true;
|
431
|
+
if (currentStep >= steps.length) {
|
432
|
+
return PromiseWrapper.resolve(result);
|
354
433
|
}
|
355
|
-
|
356
|
-
|
357
|
-
|
434
|
+
var step = steps[currentStep];
|
435
|
+
currentStep += 1;
|
436
|
+
return PromiseWrapper.resolve(step(instruction)).then(processOne);
|
437
|
+
}
|
438
|
+
return processOne();
|
439
|
+
}}, {}));
|
358
440
|
$__export("Pipeline", Pipeline);
|
441
|
+
$__export("Pipeline", Pipeline = __decorate([Injectable(), __metadata('design:paramtypes', [])], Pipeline));
|
359
442
|
}
|
360
443
|
};
|
361
444
|
});
|
@@ -519,8 +602,8 @@ System.register("angular2/src/router/path_recognizer", ["angular2/src/facade/lan
|
|
519
602
|
RegExpWrapper,
|
520
603
|
StringWrapper,
|
521
604
|
isPresent,
|
605
|
+
isBlank,
|
522
606
|
BaseException,
|
523
|
-
normalizeBlank,
|
524
607
|
StringMapWrapper,
|
525
608
|
ListWrapper,
|
526
609
|
IMPLEMENTS,
|
@@ -533,6 +616,13 @@ System.register("angular2/src/router/path_recognizer", ["angular2/src/facade/lan
|
|
533
616
|
paramMatcher,
|
534
617
|
wildcardMatcher,
|
535
618
|
PathRecognizer;
|
619
|
+
function normalizeString(obj) {
|
620
|
+
if (isBlank(obj)) {
|
621
|
+
return null;
|
622
|
+
} else {
|
623
|
+
return obj.toString();
|
624
|
+
}
|
625
|
+
}
|
536
626
|
function parsePathString(route) {
|
537
627
|
if (StringWrapper.startsWith(route, "/")) {
|
538
628
|
route = StringWrapper.substring(route, 1);
|
@@ -562,10 +652,10 @@ System.register("angular2/src/router/path_recognizer", ["angular2/src/facade/lan
|
|
562
652
|
specificity += 100 * (100 - i);
|
563
653
|
}
|
564
654
|
}
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
655
|
+
var result = StringMapWrapper.create();
|
656
|
+
StringMapWrapper.set(result, 'segments', results);
|
657
|
+
StringMapWrapper.set(result, 'specificity', specificity);
|
658
|
+
return result;
|
569
659
|
}
|
570
660
|
function splitBySlash(url) {
|
571
661
|
return url.split('/');
|
@@ -575,8 +665,8 @@ System.register("angular2/src/router/path_recognizer", ["angular2/src/facade/lan
|
|
575
665
|
RegExpWrapper = $__m.RegExpWrapper;
|
576
666
|
StringWrapper = $__m.StringWrapper;
|
577
667
|
isPresent = $__m.isPresent;
|
668
|
+
isBlank = $__m.isBlank;
|
578
669
|
BaseException = $__m.BaseException;
|
579
|
-
normalizeBlank = $__m.normalizeBlank;
|
580
670
|
IMPLEMENTS = $__m.IMPLEMENTS;
|
581
671
|
}, function($__m) {
|
582
672
|
StringMapWrapper = $__m.StringMapWrapper;
|
@@ -620,7 +710,6 @@ System.register("angular2/src/router/path_recognizer", ["angular2/src/facade/lan
|
|
620
710
|
return '';
|
621
711
|
}}, {}, $__super);
|
622
712
|
}(Segment));
|
623
|
-
$__export("ContinuationSegment", ContinuationSegment);
|
624
713
|
StaticSegment = (function($__super) {
|
625
714
|
function StaticSegment(string) {
|
626
715
|
$traceurRuntime.superConstructor(StaticSegment).call(this);
|
@@ -639,7 +728,7 @@ System.register("angular2/src/router/path_recognizer", ["angular2/src/facade/lan
|
|
639
728
|
if (!StringMapWrapper.contains(params, this.name)) {
|
640
729
|
throw new BaseException(("Route generator for '" + this.name + "' was not included in parameters passed."));
|
641
730
|
}
|
642
|
-
return
|
731
|
+
return normalizeString(StringMapWrapper.get(params, this.name));
|
643
732
|
}}, {}));
|
644
733
|
DynamicSegment = __decorate([IMPLEMENTS(Segment), __metadata('design:paramtypes', [String])], DynamicSegment);
|
645
734
|
StarSegment = (function() {
|
@@ -648,7 +737,7 @@ System.register("angular2/src/router/path_recognizer", ["angular2/src/facade/lan
|
|
648
737
|
this.regex = "(.+)";
|
649
738
|
}
|
650
739
|
return ($traceurRuntime.createClass)(StarSegment, {generate: function(params) {
|
651
|
-
return
|
740
|
+
return normalizeString(StringMapWrapper.get(params, this.name));
|
652
741
|
}}, {});
|
653
742
|
}());
|
654
743
|
paramMatcher = RegExpWrapper.create("^:([^\/]+)$");
|
@@ -659,7 +748,6 @@ System.register("angular2/src/router/path_recognizer", ["angular2/src/facade/lan
|
|
659
748
|
this.path = path;
|
660
749
|
this.handler = handler;
|
661
750
|
this.terminal = true;
|
662
|
-
this.segments = [];
|
663
751
|
var parsed = parsePathString(path);
|
664
752
|
var specificity = parsed['specificity'];
|
665
753
|
var segments = parsed['segments'];
|
@@ -697,8 +785,11 @@ System.register("angular2/src/router/path_recognizer", ["angular2/src/facade/lan
|
|
697
785
|
},
|
698
786
|
generate: function(params) {
|
699
787
|
return ListWrapper.join(ListWrapper.map(this.segments, (function(segment) {
|
700
|
-
return
|
701
|
-
})), '');
|
788
|
+
return segment.generate(params);
|
789
|
+
})), '/');
|
790
|
+
},
|
791
|
+
resolveComponentType: function() {
|
792
|
+
return this.handler.resolveComponentType();
|
702
793
|
}
|
703
794
|
}, {});
|
704
795
|
}());
|
@@ -713,36 +804,58 @@ System.register("angular2/src/router/router", ["angular2/src/facade/async", "ang
|
|
713
804
|
var PromiseWrapper,
|
714
805
|
EventEmitter,
|
715
806
|
ObservableWrapper,
|
716
|
-
|
807
|
+
ListWrapper,
|
717
808
|
isBlank,
|
809
|
+
isString,
|
810
|
+
StringWrapper,
|
718
811
|
isPresent,
|
812
|
+
isArray,
|
813
|
+
BaseException,
|
814
|
+
_resolveToTrue,
|
815
|
+
_resolveToFalse,
|
719
816
|
Router,
|
720
817
|
RootRouter,
|
721
|
-
ChildRouter
|
818
|
+
ChildRouter,
|
819
|
+
SLASH;
|
820
|
+
function splitAndFlattenLinkParams(linkParams) {
|
821
|
+
return ListWrapper.reduce(linkParams, (function(accumulation, item) {
|
822
|
+
if (isString(item)) {
|
823
|
+
return ListWrapper.concat(accumulation, StringWrapper.split(item, SLASH));
|
824
|
+
}
|
825
|
+
accumulation.push(item);
|
826
|
+
return accumulation;
|
827
|
+
}), []);
|
828
|
+
}
|
722
829
|
return {
|
723
830
|
setters: [function($__m) {
|
724
831
|
PromiseWrapper = $__m.PromiseWrapper;
|
725
832
|
EventEmitter = $__m.EventEmitter;
|
726
833
|
ObservableWrapper = $__m.ObservableWrapper;
|
727
834
|
}, function($__m) {
|
728
|
-
|
835
|
+
ListWrapper = $__m.ListWrapper;
|
729
836
|
}, function($__m) {
|
730
837
|
isBlank = $__m.isBlank;
|
838
|
+
isString = $__m.isString;
|
839
|
+
StringWrapper = $__m.StringWrapper;
|
731
840
|
isPresent = $__m.isPresent;
|
841
|
+
isArray = $__m.isArray;
|
842
|
+
BaseException = $__m.BaseException;
|
732
843
|
}],
|
733
844
|
execute: function() {
|
845
|
+
_resolveToTrue = PromiseWrapper.resolve(true);
|
846
|
+
_resolveToFalse = PromiseWrapper.resolve(false);
|
734
847
|
Router = (function() {
|
735
|
-
function Router(
|
736
|
-
this.
|
848
|
+
function Router(registry, _pipeline, parent, hostComponent) {
|
849
|
+
this.registry = registry;
|
737
850
|
this._pipeline = _pipeline;
|
738
851
|
this.parent = parent;
|
739
852
|
this.hostComponent = hostComponent;
|
740
853
|
this.navigating = false;
|
741
854
|
this.previousUrl = null;
|
855
|
+
this._currentInstruction = null;
|
856
|
+
this._currentNavigation = _resolveToTrue;
|
742
857
|
this._outlet = null;
|
743
858
|
this._subject = new EventEmitter();
|
744
|
-
this._currentInstruction = null;
|
745
|
-
this._currentNavigation = PromiseWrapper.resolve(true);
|
746
859
|
}
|
747
860
|
return ($traceurRuntime.createClass)(Router, {
|
748
861
|
childRouter: function(hostComponent) {
|
@@ -753,16 +866,16 @@ System.register("angular2/src/router/router", ["angular2/src/facade/async", "ang
|
|
753
866
|
if (isPresent(this._currentInstruction)) {
|
754
867
|
return outlet.activate(this._currentInstruction);
|
755
868
|
}
|
756
|
-
return
|
869
|
+
return _resolveToTrue;
|
757
870
|
},
|
758
871
|
config: function(config) {
|
759
872
|
var $__0 = this;
|
760
|
-
if (config
|
873
|
+
if (isArray(config)) {
|
761
874
|
config.forEach((function(configObject) {
|
762
|
-
$__0.
|
875
|
+
$__0.registry.config($__0.hostComponent, configObject);
|
763
876
|
}));
|
764
877
|
} else {
|
765
|
-
this.
|
878
|
+
this.registry.config(this.hostComponent, config);
|
766
879
|
}
|
767
880
|
return this.renavigate();
|
768
881
|
},
|
@@ -774,7 +887,7 @@ System.register("angular2/src/router/router", ["angular2/src/facade/async", "ang
|
|
774
887
|
this.lastNavigationAttempt = url;
|
775
888
|
return this._currentNavigation = this.recognize(url).then((function(matchedInstruction) {
|
776
889
|
if (isBlank(matchedInstruction)) {
|
777
|
-
return
|
890
|
+
return _resolveToFalse;
|
778
891
|
}
|
779
892
|
if (isPresent($__0._currentInstruction)) {
|
780
893
|
matchedInstruction.reuseComponentsFrom($__0._currentInstruction);
|
@@ -804,16 +917,16 @@ System.register("angular2/src/router/router", ["angular2/src/facade/async", "ang
|
|
804
917
|
if (isPresent(this._outlet)) {
|
805
918
|
return this._outlet.activate(instruction);
|
806
919
|
}
|
807
|
-
return
|
920
|
+
return _resolveToTrue;
|
808
921
|
},
|
809
922
|
deactivate: function() {
|
810
923
|
if (isPresent(this._outlet)) {
|
811
924
|
return this._outlet.deactivate();
|
812
925
|
}
|
813
|
-
return
|
926
|
+
return _resolveToTrue;
|
814
927
|
},
|
815
928
|
recognize: function(url) {
|
816
|
-
return this.
|
929
|
+
return this.registry.recognize(url, this.hostComponent);
|
817
930
|
},
|
818
931
|
renavigate: function() {
|
819
932
|
var destination = isBlank(this.previousUrl) ? this.lastNavigationAttempt : this.previousUrl;
|
@@ -822,8 +935,39 @@ System.register("angular2/src/router/router", ["angular2/src/facade/async", "ang
|
|
822
935
|
}
|
823
936
|
return this.navigate(destination);
|
824
937
|
},
|
825
|
-
generate: function(
|
826
|
-
|
938
|
+
generate: function(linkParams) {
|
939
|
+
var normalizedLinkParams = splitAndFlattenLinkParams(linkParams);
|
940
|
+
var first = ListWrapper.first(normalizedLinkParams);
|
941
|
+
var rest = ListWrapper.slice(normalizedLinkParams, 1);
|
942
|
+
var router = this;
|
943
|
+
if (first == '') {
|
944
|
+
while (isPresent(router.parent)) {
|
945
|
+
router = router.parent;
|
946
|
+
}
|
947
|
+
} else if (first == '..') {
|
948
|
+
router = router.parent;
|
949
|
+
while (ListWrapper.first(rest) == '..') {
|
950
|
+
rest = ListWrapper.slice(rest, 1);
|
951
|
+
router = router.parent;
|
952
|
+
if (isBlank(router)) {
|
953
|
+
throw new BaseException(("Link \"" + ListWrapper.toJSON(linkParams) + "\" has too many \"../\" segments."));
|
954
|
+
}
|
955
|
+
}
|
956
|
+
} else if (first != '.') {
|
957
|
+
throw new BaseException(("Link \"" + ListWrapper.toJSON(linkParams) + "\" must start with \"/\", \"./\", or \"../\""));
|
958
|
+
}
|
959
|
+
if (rest[rest.length - 1] == '') {
|
960
|
+
ListWrapper.removeLast(rest);
|
961
|
+
}
|
962
|
+
if (rest.length < 1) {
|
963
|
+
var msg = ("Link \"" + ListWrapper.toJSON(linkParams) + "\" must include a route name.");
|
964
|
+
throw new BaseException(msg);
|
965
|
+
}
|
966
|
+
var url = '';
|
967
|
+
if (isPresent(router.parent) && isPresent(router.parent._currentInstruction)) {
|
968
|
+
url = router.parent._currentInstruction.capturedUrl;
|
969
|
+
}
|
970
|
+
return url + '/' + this.registry.generate(rest, router.hostComponent);
|
827
971
|
}
|
828
972
|
}, {});
|
829
973
|
}());
|
@@ -836,7 +980,7 @@ System.register("angular2/src/router/router", ["angular2/src/facade/async", "ang
|
|
836
980
|
this._location.subscribe(($__0 = this, function(change) {
|
837
981
|
return $__0.navigate(change['url']);
|
838
982
|
}));
|
839
|
-
this.
|
983
|
+
this.registry.configFromComponent(hostComponent);
|
840
984
|
this.navigate(location.path());
|
841
985
|
}
|
842
986
|
return ($traceurRuntime.createClass)(RootRouter, {commit: function(instruction) {
|
@@ -849,46 +993,34 @@ System.register("angular2/src/router/router", ["angular2/src/facade/async", "ang
|
|
849
993
|
$__export("RootRouter", RootRouter);
|
850
994
|
ChildRouter = (function($__super) {
|
851
995
|
function ChildRouter(parent, hostComponent) {
|
852
|
-
$traceurRuntime.superConstructor(ChildRouter).call(this, parent.
|
996
|
+
$traceurRuntime.superConstructor(ChildRouter).call(this, parent.registry, parent._pipeline, parent, hostComponent);
|
853
997
|
this.parent = parent;
|
854
998
|
}
|
855
|
-
return ($traceurRuntime.createClass)(ChildRouter, {
|
999
|
+
return ($traceurRuntime.createClass)(ChildRouter, {navigate: function(url) {
|
1000
|
+
return this.parent.navigate(url);
|
1001
|
+
}}, {}, $__super);
|
856
1002
|
}(Router));
|
1003
|
+
SLASH = new RegExp('/');
|
857
1004
|
}
|
858
1005
|
};
|
859
1006
|
});
|
860
1007
|
|
861
|
-
System.register("angular2/src/router/router_link", ["angular2/src/core/annotations/
|
1008
|
+
System.register("angular2/src/router/router_link", ["angular2/src/core/annotations/decorators", "angular2/src/router/router", "angular2/src/router/location"], function($__export) {
|
862
1009
|
"use strict";
|
863
1010
|
var __moduleName = "angular2/src/router/router_link";
|
864
1011
|
var __decorate,
|
865
1012
|
__metadata,
|
866
|
-
onAllChangesDone,
|
867
1013
|
Directive,
|
868
|
-
ElementRef,
|
869
|
-
StringMapWrapper,
|
870
|
-
isPresent,
|
871
1014
|
Router,
|
872
1015
|
Location,
|
873
|
-
Renderer,
|
874
1016
|
RouterLink;
|
875
1017
|
return {
|
876
1018
|
setters: [function($__m) {
|
877
|
-
onAllChangesDone = $__m.onAllChangesDone;
|
878
|
-
}, function($__m) {
|
879
1019
|
Directive = $__m.Directive;
|
880
|
-
}, function($__m) {
|
881
|
-
ElementRef = $__m.ElementRef;
|
882
|
-
}, function($__m) {
|
883
|
-
StringMapWrapper = $__m.StringMapWrapper;
|
884
|
-
}, function($__m) {
|
885
|
-
isPresent = $__m.isPresent;
|
886
1020
|
}, function($__m) {
|
887
1021
|
Router = $__m.Router;
|
888
1022
|
}, function($__m) {
|
889
1023
|
Location = $__m.Location;
|
890
|
-
}, function($__m) {
|
891
|
-
Renderer = $__m.Renderer;
|
892
1024
|
}],
|
893
1025
|
execute: function() {
|
894
1026
|
__decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
|
@@ -913,72 +1045,91 @@ System.register("angular2/src/router/router_link", ["angular2/src/core/annotatio
|
|
913
1045
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
914
1046
|
return Reflect.metadata(k, v);
|
915
1047
|
};
|
916
|
-
RouterLink = (($traceurRuntime.createClass)(function(
|
917
|
-
this._elementRef = _elementRef;
|
1048
|
+
RouterLink = (($traceurRuntime.createClass)(function(_router, _location) {
|
918
1049
|
this._router = _router;
|
919
1050
|
this._location = _location;
|
920
|
-
this._renderer = _renderer;
|
921
|
-
this._params = StringMapWrapper.create();
|
922
1051
|
}, {
|
923
|
-
set
|
924
|
-
this.
|
925
|
-
|
926
|
-
|
927
|
-
this._params = changes;
|
1052
|
+
set routeParams(changes) {
|
1053
|
+
this._routeParams = changes;
|
1054
|
+
this._navigationHref = this._router.generate(this._routeParams);
|
1055
|
+
this.visibleHref = this._location.normalizeAbsolutely(this._navigationHref);
|
928
1056
|
},
|
929
1057
|
onClick: function() {
|
930
1058
|
this._router.navigate(this._navigationHref);
|
931
1059
|
return false;
|
932
|
-
},
|
933
|
-
onAllChangesDone: function() {
|
934
|
-
if (isPresent(this._route) && isPresent(this._params)) {
|
935
|
-
this._navigationHref = this._router.generate(this._route, this._params);
|
936
|
-
this._visibleHref = this._location.normalizeAbsolutely(this._navigationHref);
|
937
|
-
this._renderer.setElementAttribute(this._elementRef, 'href', this._visibleHref);
|
938
|
-
}
|
939
1060
|
}
|
940
1061
|
}, {}));
|
941
1062
|
$__export("RouterLink", RouterLink);
|
942
1063
|
$__export("RouterLink", RouterLink = __decorate([Directive({
|
943
1064
|
selector: '[router-link]',
|
944
|
-
properties: ['
|
945
|
-
|
946
|
-
|
947
|
-
|
1065
|
+
properties: ['routeParams: routerLink'],
|
1066
|
+
host: {
|
1067
|
+
'(^click)': 'onClick()',
|
1068
|
+
'[attr.href]': 'visibleHref'
|
1069
|
+
}
|
1070
|
+
}), __metadata('design:paramtypes', [Router, Location])], RouterLink));
|
948
1071
|
}
|
949
1072
|
};
|
950
1073
|
});
|
951
1074
|
|
952
|
-
System.register("angular2/src/router/route_recognizer", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/router/path_recognizer"], function($__export) {
|
1075
|
+
System.register("angular2/src/router/route_recognizer", ["angular2/src/facade/lang", "angular2/src/facade/collection", "angular2/src/router/path_recognizer", "angular2/src/router/async_route_handler", "angular2/src/router/sync_route_handler"], function($__export) {
|
953
1076
|
"use strict";
|
954
1077
|
var __moduleName = "angular2/src/router/route_recognizer";
|
955
1078
|
var RegExpWrapper,
|
956
|
-
|
1079
|
+
isBlank,
|
957
1080
|
isPresent,
|
1081
|
+
isType,
|
1082
|
+
isStringMap,
|
958
1083
|
BaseException,
|
959
1084
|
Map,
|
960
1085
|
MapWrapper,
|
961
1086
|
PathRecognizer,
|
1087
|
+
AsyncRouteHandler,
|
1088
|
+
SyncRouteHandler,
|
962
1089
|
RouteRecognizer,
|
963
1090
|
RouteMatch;
|
1091
|
+
function configObjToHandler(config) {
|
1092
|
+
if (isType(config)) {
|
1093
|
+
return new SyncRouteHandler(config);
|
1094
|
+
} else if (isStringMap(config)) {
|
1095
|
+
if (isBlank(config['type'])) {
|
1096
|
+
throw new BaseException("Component declaration when provided as a map should include a 'type' property");
|
1097
|
+
}
|
1098
|
+
var componentType = config['type'];
|
1099
|
+
if (componentType == 'constructor') {
|
1100
|
+
return new SyncRouteHandler(config['constructor']);
|
1101
|
+
} else if (componentType == 'loader') {
|
1102
|
+
return new AsyncRouteHandler(config['loader']);
|
1103
|
+
} else {
|
1104
|
+
throw new BaseException("oops");
|
1105
|
+
}
|
1106
|
+
}
|
1107
|
+
throw new BaseException(("Unexpected component \"" + config + "\"."));
|
1108
|
+
}
|
964
1109
|
return {
|
965
1110
|
setters: [function($__m) {
|
966
1111
|
RegExpWrapper = $__m.RegExpWrapper;
|
967
|
-
|
1112
|
+
isBlank = $__m.isBlank;
|
968
1113
|
isPresent = $__m.isPresent;
|
1114
|
+
isType = $__m.isType;
|
1115
|
+
isStringMap = $__m.isStringMap;
|
969
1116
|
BaseException = $__m.BaseException;
|
970
1117
|
}, function($__m) {
|
971
1118
|
Map = $__m.Map;
|
972
1119
|
MapWrapper = $__m.MapWrapper;
|
973
1120
|
}, function($__m) {
|
974
1121
|
PathRecognizer = $__m.PathRecognizer;
|
1122
|
+
}, function($__m) {
|
1123
|
+
AsyncRouteHandler = $__m.AsyncRouteHandler;
|
1124
|
+
}, function($__m) {
|
1125
|
+
SyncRouteHandler = $__m.SyncRouteHandler;
|
975
1126
|
}],
|
976
1127
|
execute: function() {
|
977
1128
|
RouteRecognizer = (function() {
|
978
1129
|
function RouteRecognizer() {
|
979
1130
|
this.names = new Map();
|
980
|
-
this.matchers = new Map();
|
981
1131
|
this.redirects = new Map();
|
1132
|
+
this.matchers = new Map();
|
982
1133
|
}
|
983
1134
|
return ($traceurRuntime.createClass)(RouteRecognizer, {
|
984
1135
|
addRedirect: function(path, target) {
|
@@ -987,8 +1138,9 @@ System.register("angular2/src/router/route_recognizer", ["angular2/src/facade/la
|
|
987
1138
|
}
|
988
1139
|
this.redirects.set(path, target);
|
989
1140
|
},
|
990
|
-
addConfig: function(path,
|
1141
|
+
addConfig: function(path, handlerObj) {
|
991
1142
|
var alias = arguments[2] !== (void 0) ? arguments[2] : null;
|
1143
|
+
var handler = configObjToHandler(handlerObj['component']);
|
992
1144
|
var recognizer = new PathRecognizer(path, handler);
|
993
1145
|
MapWrapper.forEach(this.matchers, (function(matcher, _) {
|
994
1146
|
if (recognizer.regex.toString() == matcher.regex.toString()) {
|
@@ -1011,8 +1163,8 @@ System.register("angular2/src/router/route_recognizer", ["angular2/src/facade/la
|
|
1011
1163
|
if (path == url) {
|
1012
1164
|
url = target;
|
1013
1165
|
}
|
1014
|
-
} else if (
|
1015
|
-
url = target +
|
1166
|
+
} else if (url.startsWith(path)) {
|
1167
|
+
url = target + url.substring(path.length);
|
1016
1168
|
}
|
1017
1169
|
}));
|
1018
1170
|
MapWrapper.forEach(this.matchers, (function(pathRecognizer, regex) {
|
@@ -1022,15 +1174,9 @@ System.register("angular2/src/router/route_recognizer", ["angular2/src/facade/la
|
|
1022
1174
|
var unmatchedUrl = '';
|
1023
1175
|
if (url != '/') {
|
1024
1176
|
matchedUrl = match[0];
|
1025
|
-
unmatchedUrl =
|
1177
|
+
unmatchedUrl = url.substring(match[0].length);
|
1026
1178
|
}
|
1027
|
-
solutions.push(new RouteMatch(
|
1028
|
-
specificity: pathRecognizer.specificity,
|
1029
|
-
handler: pathRecognizer.handler,
|
1030
|
-
params: pathRecognizer.parseParams(url),
|
1031
|
-
matchedUrl: matchedUrl,
|
1032
|
-
unmatchedUrl: unmatchedUrl
|
1033
|
-
}));
|
1179
|
+
solutions.push(new RouteMatch(pathRecognizer, matchedUrl, unmatchedUrl));
|
1034
1180
|
}
|
1035
1181
|
}));
|
1036
1182
|
return solutions;
|
@@ -1040,36 +1186,39 @@ System.register("angular2/src/router/route_recognizer", ["angular2/src/facade/la
|
|
1040
1186
|
},
|
1041
1187
|
generate: function(name, params) {
|
1042
1188
|
var pathRecognizer = this.names.get(name);
|
1043
|
-
|
1189
|
+
if (isBlank(pathRecognizer)) {
|
1190
|
+
return null;
|
1191
|
+
}
|
1192
|
+
var url = pathRecognizer.generate(params);
|
1193
|
+
return {
|
1194
|
+
url: url,
|
1195
|
+
'nextComponent': pathRecognizer.handler.componentType
|
1196
|
+
};
|
1044
1197
|
}
|
1045
1198
|
}, {});
|
1046
1199
|
}());
|
1047
1200
|
$__export("RouteRecognizer", RouteRecognizer);
|
1048
1201
|
RouteMatch = (function() {
|
1049
|
-
function RouteMatch() {
|
1050
|
-
|
1051
|
-
specificity = $__1.specificity,
|
1052
|
-
handler = $__1.handler,
|
1053
|
-
params = $__1.params,
|
1054
|
-
matchedUrl = $__1.matchedUrl,
|
1055
|
-
unmatchedUrl = $__1.unmatchedUrl;
|
1056
|
-
this.specificity = specificity;
|
1057
|
-
this.handler = handler;
|
1058
|
-
this.params = params;
|
1202
|
+
function RouteMatch(recognizer, matchedUrl, unmatchedUrl) {
|
1203
|
+
this.recognizer = recognizer;
|
1059
1204
|
this.matchedUrl = matchedUrl;
|
1060
1205
|
this.unmatchedUrl = unmatchedUrl;
|
1061
1206
|
}
|
1062
|
-
return ($traceurRuntime.createClass)(RouteMatch, {
|
1207
|
+
return ($traceurRuntime.createClass)(RouteMatch, {params: function() {
|
1208
|
+
return this.recognizer.parseParams(this.matchedUrl);
|
1209
|
+
}}, {});
|
1063
1210
|
}());
|
1064
1211
|
$__export("RouteMatch", RouteMatch);
|
1065
1212
|
}
|
1066
1213
|
};
|
1067
1214
|
});
|
1068
1215
|
|
1069
|
-
System.register("angular2/src/router/route_registry", ["angular2/src/router/route_recognizer", "angular2/src/router/instruction", "angular2/src/facade/collection", "angular2/src/facade/async", "angular2/src/facade/lang", "angular2/src/router/route_config_impl", "angular2/src/reflection/reflection"], function($__export) {
|
1216
|
+
System.register("angular2/src/router/route_registry", ["angular2/src/router/route_recognizer", "angular2/src/router/instruction", "angular2/src/facade/collection", "angular2/src/facade/async", "angular2/src/facade/lang", "angular2/src/router/route_config_impl", "angular2/src/reflection/reflection", "angular2/di"], function($__export) {
|
1070
1217
|
"use strict";
|
1071
1218
|
var __moduleName = "angular2/src/router/route_registry";
|
1072
|
-
var
|
1219
|
+
var __decorate,
|
1220
|
+
__metadata,
|
1221
|
+
RouteRecognizer,
|
1073
1222
|
Instruction,
|
1074
1223
|
ListWrapper,
|
1075
1224
|
Map,
|
@@ -1078,10 +1227,12 @@ System.register("angular2/src/router/route_registry", ["angular2/src/router/rout
|
|
1078
1227
|
isPresent,
|
1079
1228
|
isBlank,
|
1080
1229
|
isType,
|
1230
|
+
isString,
|
1081
1231
|
isStringMap,
|
1082
1232
|
BaseException,
|
1083
1233
|
RouteConfig,
|
1084
1234
|
reflector,
|
1235
|
+
Injectable,
|
1085
1236
|
RouteRegistry,
|
1086
1237
|
ALLOWED_TARGETS,
|
1087
1238
|
VALID_COMPONENT_TYPES;
|
@@ -1118,18 +1269,6 @@ System.register("angular2/src/router/route_registry", ["angular2/src/router/rout
|
|
1118
1269
|
throw new BaseException("Component declaration should be either a Map or a Type");
|
1119
1270
|
}
|
1120
1271
|
}
|
1121
|
-
function componentHandlerToComponentType(handler) {
|
1122
|
-
var componentDeclaration = handler['component'],
|
1123
|
-
type = componentDeclaration['type'];
|
1124
|
-
if (type == 'constructor') {
|
1125
|
-
return PromiseWrapper.resolve(componentDeclaration['constructor']);
|
1126
|
-
} else if (type == 'loader') {
|
1127
|
-
var resolverFunction = componentDeclaration['loader'];
|
1128
|
-
return resolverFunction();
|
1129
|
-
} else {
|
1130
|
-
throw new BaseException(("Cannot extract the component type from a '" + type + "' component"));
|
1131
|
-
}
|
1132
|
-
}
|
1133
1272
|
function mostSpecific(instructions) {
|
1134
1273
|
var mostSpecificSolution = instructions[0];
|
1135
1274
|
for (var solutionIndex = 1; solutionIndex < instructions.length; solutionIndex++) {
|
@@ -1169,114 +1308,153 @@ System.register("angular2/src/router/route_registry", ["angular2/src/router/rout
|
|
1169
1308
|
isPresent = $__m.isPresent;
|
1170
1309
|
isBlank = $__m.isBlank;
|
1171
1310
|
isType = $__m.isType;
|
1311
|
+
isString = $__m.isString;
|
1172
1312
|
isStringMap = $__m.isStringMap;
|
1173
1313
|
BaseException = $__m.BaseException;
|
1174
1314
|
}, function($__m) {
|
1175
1315
|
RouteConfig = $__m.RouteConfig;
|
1176
1316
|
}, function($__m) {
|
1177
1317
|
reflector = $__m.reflector;
|
1318
|
+
}, function($__m) {
|
1319
|
+
Injectable = $__m.Injectable;
|
1178
1320
|
}],
|
1179
1321
|
execute: function() {
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1322
|
+
__decorate = (this && this.__decorate) || function(decorators, target, key, desc) {
|
1323
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
1324
|
+
return Reflect.decorate(decorators, target, key, desc);
|
1325
|
+
switch (arguments.length) {
|
1326
|
+
case 2:
|
1327
|
+
return decorators.reduceRight(function(o, d) {
|
1328
|
+
return (d && d(o)) || o;
|
1329
|
+
}, target);
|
1330
|
+
case 3:
|
1331
|
+
return decorators.reduceRight(function(o, d) {
|
1332
|
+
return (d && d(target, key)), void 0;
|
1333
|
+
}, void 0);
|
1334
|
+
case 4:
|
1335
|
+
return decorators.reduceRight(function(o, d) {
|
1336
|
+
return (d && d(target, key, o)) || o;
|
1337
|
+
}, desc);
|
1183
1338
|
}
|
1184
|
-
|
1185
|
-
|
1186
|
-
|
1187
|
-
|
1188
|
-
|
1189
|
-
|
1190
|
-
|
1191
|
-
|
1192
|
-
|
1193
|
-
|
1194
|
-
|
1339
|
+
};
|
1340
|
+
__metadata = (this && this.__metadata) || function(k, v) {
|
1341
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
1342
|
+
return Reflect.metadata(k, v);
|
1343
|
+
};
|
1344
|
+
RouteRegistry = (($traceurRuntime.createClass)(function() {
|
1345
|
+
this._rules = new Map();
|
1346
|
+
}, {
|
1347
|
+
config: function(parentComponent, config) {
|
1348
|
+
assertValidConfig(config);
|
1349
|
+
var recognizer = this._rules.get(parentComponent);
|
1350
|
+
if (isBlank(recognizer)) {
|
1351
|
+
recognizer = new RouteRecognizer();
|
1352
|
+
this._rules.set(parentComponent, recognizer);
|
1353
|
+
}
|
1354
|
+
if (StringMapWrapper.contains(config, 'redirectTo')) {
|
1355
|
+
recognizer.addRedirect(config['path'], config['redirectTo']);
|
1356
|
+
return ;
|
1357
|
+
}
|
1358
|
+
config = StringMapWrapper.merge(config, {'component': normalizeComponentDeclaration(config['component'])});
|
1359
|
+
var component = config['component'];
|
1360
|
+
var terminal = recognizer.addConfig(config['path'], config, config['as']);
|
1361
|
+
if (component['type'] == 'constructor') {
|
1362
|
+
if (terminal) {
|
1363
|
+
assertTerminalComponent(component['constructor'], config['path']);
|
1364
|
+
} else {
|
1365
|
+
this.configFromComponent(component['constructor']);
|
1195
1366
|
}
|
1196
|
-
|
1197
|
-
|
1198
|
-
|
1199
|
-
|
1200
|
-
|
1201
|
-
|
1202
|
-
|
1203
|
-
|
1367
|
+
}
|
1368
|
+
},
|
1369
|
+
configFromComponent: function(component) {
|
1370
|
+
var $__0 = this;
|
1371
|
+
if (!isType(component)) {
|
1372
|
+
return ;
|
1373
|
+
}
|
1374
|
+
if (this._rules.has(component)) {
|
1375
|
+
return ;
|
1376
|
+
}
|
1377
|
+
var annotations = reflector.annotations(component);
|
1378
|
+
if (isPresent(annotations)) {
|
1379
|
+
for (var i = 0; i < annotations.length; i++) {
|
1380
|
+
var annotation = annotations[i];
|
1381
|
+
if (annotation instanceof RouteConfig) {
|
1382
|
+
ListWrapper.forEach(annotation.configs, (function(config) {
|
1383
|
+
return $__0.config(component, config);
|
1384
|
+
}));
|
1204
1385
|
}
|
1205
1386
|
}
|
1206
|
-
}
|
1207
|
-
|
1208
|
-
|
1209
|
-
|
1210
|
-
|
1387
|
+
}
|
1388
|
+
},
|
1389
|
+
recognize: function(url, parentComponent) {
|
1390
|
+
var $__0 = this;
|
1391
|
+
var componentRecognizer = this._rules.get(parentComponent);
|
1392
|
+
if (isBlank(componentRecognizer)) {
|
1393
|
+
return PromiseWrapper.resolve(null);
|
1394
|
+
}
|
1395
|
+
var possibleMatches = componentRecognizer.recognize(url);
|
1396
|
+
var matchPromises = ListWrapper.map(possibleMatches, (function(candidate) {
|
1397
|
+
return $__0._completeRouteMatch(candidate);
|
1398
|
+
}));
|
1399
|
+
return PromiseWrapper.all(matchPromises).then((function(solutions) {
|
1400
|
+
var fullSolutions = ListWrapper.filter(solutions, (function(solution) {
|
1401
|
+
return isPresent(solution);
|
1402
|
+
}));
|
1403
|
+
if (fullSolutions.length > 0) {
|
1404
|
+
return mostSpecific(fullSolutions);
|
1211
1405
|
}
|
1212
|
-
|
1213
|
-
|
1406
|
+
return null;
|
1407
|
+
}));
|
1408
|
+
},
|
1409
|
+
_completeRouteMatch: function(partialMatch) {
|
1410
|
+
var $__0 = this;
|
1411
|
+
var recognizer = partialMatch.recognizer;
|
1412
|
+
var handler = recognizer.handler;
|
1413
|
+
return handler.resolveComponentType().then((function(componentType) {
|
1414
|
+
$__0.configFromComponent(componentType);
|
1415
|
+
if (partialMatch.unmatchedUrl.length == 0) {
|
1416
|
+
return new Instruction(componentType, partialMatch.matchedUrl, recognizer);
|
1214
1417
|
}
|
1215
|
-
|
1216
|
-
|
1217
|
-
|
1218
|
-
|
1219
|
-
|
1220
|
-
ListWrapper.forEach(annotation.configs, (function(config) {
|
1221
|
-
return $__0.config(component, config);
|
1222
|
-
}));
|
1223
|
-
}
|
1418
|
+
return $__0.recognize(partialMatch.unmatchedUrl, componentType).then((function(childInstruction) {
|
1419
|
+
if (isBlank(childInstruction)) {
|
1420
|
+
return null;
|
1421
|
+
} else {
|
1422
|
+
return new Instruction(componentType, partialMatch.matchedUrl, recognizer, childInstruction);
|
1224
1423
|
}
|
1424
|
+
}));
|
1425
|
+
}));
|
1426
|
+
},
|
1427
|
+
generate: function(linkParams, parentComponent) {
|
1428
|
+
var url = '';
|
1429
|
+
var componentCursor = parentComponent;
|
1430
|
+
for (var i = 0; i < linkParams.length; i += 1) {
|
1431
|
+
var segment = linkParams[i];
|
1432
|
+
if (!isString(segment)) {
|
1433
|
+
throw new BaseException(("Unexpected segment \"" + segment + "\" in link DSL. Expected a string."));
|
1434
|
+
} else if (segment == '' || segment == '.' || segment == '..') {
|
1435
|
+
throw new BaseException(("\"" + segment + "/\" is only allowed at the beginning of a link DSL."));
|
1225
1436
|
}
|
1226
|
-
|
1227
|
-
|
1228
|
-
|
1229
|
-
|
1437
|
+
var params = null;
|
1438
|
+
if (i + 1 < linkParams.length) {
|
1439
|
+
var nextSegment = linkParams[i + 1];
|
1440
|
+
if (isStringMap(nextSegment)) {
|
1441
|
+
params = nextSegment;
|
1442
|
+
i += 1;
|
1443
|
+
}
|
1444
|
+
}
|
1445
|
+
var componentRecognizer = this._rules.get(componentCursor);
|
1230
1446
|
if (isBlank(componentRecognizer)) {
|
1231
|
-
|
1447
|
+
throw new BaseException(("Could not find route config for \"" + segment + "\"."));
|
1232
1448
|
}
|
1233
|
-
var
|
1234
|
-
|
1235
|
-
|
1236
|
-
}));
|
1237
|
-
return PromiseWrapper.all(matchPromises).then((function(solutions) {
|
1238
|
-
var fullSolutions = ListWrapper.filter(solutions, (function(solution) {
|
1239
|
-
return isPresent(solution);
|
1240
|
-
}));
|
1241
|
-
if (fullSolutions.length > 0) {
|
1242
|
-
return mostSpecific(fullSolutions);
|
1243
|
-
}
|
1244
|
-
return null;
|
1245
|
-
}));
|
1246
|
-
},
|
1247
|
-
_completeRouteMatch: function(candidate) {
|
1248
|
-
var $__0 = this;
|
1249
|
-
return componentHandlerToComponentType(candidate.handler).then((function(componentType) {
|
1250
|
-
$__0.configFromComponent(componentType);
|
1251
|
-
if (candidate.unmatchedUrl.length == 0) {
|
1252
|
-
return new Instruction({
|
1253
|
-
component: componentType,
|
1254
|
-
params: candidate.params,
|
1255
|
-
matchedUrl: candidate.matchedUrl,
|
1256
|
-
parentSpecificity: candidate.specificity
|
1257
|
-
});
|
1258
|
-
}
|
1259
|
-
return $__0.recognize(candidate.unmatchedUrl, componentType).then((function(childInstruction) {
|
1260
|
-
if (isBlank(childInstruction)) {
|
1261
|
-
return null;
|
1262
|
-
}
|
1263
|
-
return new Instruction({
|
1264
|
-
component: componentType,
|
1265
|
-
child: childInstruction,
|
1266
|
-
params: candidate.params,
|
1267
|
-
matchedUrl: candidate.matchedUrl,
|
1268
|
-
parentSpecificity: candidate.specificity
|
1269
|
-
});
|
1270
|
-
}));
|
1271
|
-
}));
|
1272
|
-
},
|
1273
|
-
generate: function(name, params, hostComponent) {
|
1274
|
-
var componentRecognizer = this._rules.get(hostComponent);
|
1275
|
-
return isPresent(componentRecognizer) ? componentRecognizer.generate(name, params) : null;
|
1449
|
+
var response = componentRecognizer.generate(segment, params);
|
1450
|
+
url += response['url'];
|
1451
|
+
componentCursor = response['nextComponent'];
|
1276
1452
|
}
|
1277
|
-
|
1278
|
-
|
1453
|
+
return url;
|
1454
|
+
}
|
1455
|
+
}, {}));
|
1279
1456
|
$__export("RouteRegistry", RouteRegistry);
|
1457
|
+
$__export("RouteRegistry", RouteRegistry = __decorate([Injectable(), __metadata('design:paramtypes', [])], RouteRegistry));
|
1280
1458
|
ALLOWED_TARGETS = ['component', 'redirectTo'];
|
1281
1459
|
VALID_COMPONENT_TYPES = ['constructor', 'loader'];
|
1282
1460
|
}
|
@@ -1347,11 +1525,10 @@ System.register("angular2/src/router/router_outlet", ["angular2/src/facade/async
|
|
1347
1525
|
decorator(target, key, paramIndex);
|
1348
1526
|
};
|
1349
1527
|
};
|
1350
|
-
RouterOutlet = (($traceurRuntime.createClass)(function(
|
1528
|
+
RouterOutlet = (($traceurRuntime.createClass)(function(_elementRef, _loader, _parentRouter, nameAttr) {
|
1529
|
+
this._elementRef = _elementRef;
|
1351
1530
|
this._loader = _loader;
|
1352
1531
|
this._parentRouter = _parentRouter;
|
1353
|
-
this._injector = _injector;
|
1354
|
-
this._elementRef = elementRef;
|
1355
1532
|
this._childRouter = null;
|
1356
1533
|
this._componentRef = null;
|
1357
1534
|
this._currentInstruction = null;
|
@@ -1364,9 +1541,10 @@ System.register("angular2/src/router/router_outlet", ["angular2/src/facade/async
|
|
1364
1541
|
}
|
1365
1542
|
this._currentInstruction = instruction;
|
1366
1543
|
this._childRouter = this._parentRouter.childRouter(instruction.component);
|
1367
|
-
var
|
1544
|
+
var params = new RouteParams(instruction.params());
|
1545
|
+
var bindings = Injector.resolve([bind(RouteParams).toValue(params), bind(routerMod.Router).toValue(this._childRouter)]);
|
1368
1546
|
return this.deactivate().then((function(_) {
|
1369
|
-
return $__0._loader.loadNextToLocation(instruction.component, $__0._elementRef,
|
1547
|
+
return $__0._loader.loadNextToLocation(instruction.component, $__0._elementRef, bindings);
|
1370
1548
|
})).then((function(componentRef) {
|
1371
1549
|
$__0._componentRef = componentRef;
|
1372
1550
|
return $__0._childRouter.commit(instruction.child);
|
@@ -1386,7 +1564,7 @@ System.register("angular2/src/router/router_outlet", ["angular2/src/facade/async
|
|
1386
1564
|
}
|
1387
1565
|
}, {}));
|
1388
1566
|
$__export("RouterOutlet", RouterOutlet);
|
1389
|
-
$__export("RouterOutlet", RouterOutlet = __decorate([Directive({selector: 'router-outlet'}), __param(
|
1567
|
+
$__export("RouterOutlet", RouterOutlet = __decorate([Directive({selector: 'router-outlet'}), __param(3, Attribute('name')), __metadata('design:paramtypes', [ElementRef, DynamicComponentLoader, routerMod.Router, String])], RouterOutlet));
|
1390
1568
|
}
|
1391
1569
|
};
|
1392
1570
|
});
|