File tree Expand file tree Collapse file tree
modules/angular2/src/core/compiler Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import { Type , isPresent } from 'angular2/src/facade/lang' ;
2+ import { Map , MapWrapper } from 'angular2/src/facade/lang' ;
3+
4+ export class ComponentUrlMapper {
5+ // Returns the url to the component source file.
6+ // The returned url could be:
7+ // - an absolute URL,
8+ // - a URL relative to the application
9+ getUrl ( component : Type ) : string {
10+ return './' ;
11+ }
12+ }
13+
14+ export class RuntimeComponentUrlMapper extends ComponentUrlMapper {
15+ _componentUrls : Map ;
16+
17+ constructor ( ) {
18+ super ( ) ;
19+ this . _componentUrls = MapWrapper . create ( ) ;
20+ }
21+
22+ setComponentUrl ( component : Type , url : string ) {
23+ MapWrapper . set ( this . _componentUrls , component , url ) ;
24+ }
25+
26+ getUrl ( component : Type ) : string {
27+ var url = MapWrapper . get ( this . _componentUrls , component ) ;
28+ if ( isPresent ( url ) ) return url ;
29+ return super . getUrl ( component ) ;
30+ }
31+ }
You can’t perform that action at this time.
0 commit comments