Skip to content

Commit b602bd8

Browse files
committed
refactor(Location): out of router and into platform/common
closes angular#4943 BREAKING CHANGE: `Location` and other related providers have been moved out of `router` and into `platform/common`. `BrowserPlatformLocation` is not meant to be used directly however advanced configurations may use it via the following import change. Before: ``` import { PlatformLocation, Location, LocationStrategy, HashLocationStrategy, PathLocationStrategy, APP_BASE_HREF} from 'angular2/router'; import {BrowserPlatformLocation} from 'angular2/src/router/location/browser_platform_location'; ``` After: ``` import { PlatformLocation, Location, LocationStrategy, HashLocationStrategy, PathLocationStrategy, APP_BASE_HREF} from 'angular2/platform/common'; import {BrowserPlatformLocation} from 'angular2/src/platform/browser/location/browser_platform_location'; ``` Closes angular#7962
1 parent 30c4352 commit b602bd8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+187
-178
lines changed

modules/angular2/common.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
export * from './src/common/pipes';
22
export * from './src/common/directives';
33
export * from './src/common/forms';
4-
export * from './src/common/common_directives';
4+
export * from './src/common/common_directives';

modules/angular2/examples/router/ts/can_activate/can_activate_example.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
import {provide, Component} from 'angular2/core';
22
import {bootstrap} from 'angular2/platform/browser';
3-
import {
4-
CanActivate,
5-
RouteConfig,
6-
ComponentInstruction,
7-
APP_BASE_HREF,
8-
ROUTER_DIRECTIVES
9-
} from 'angular2/router';
3+
import {CanActivate, RouteConfig, ComponentInstruction, ROUTER_DIRECTIVES} from 'angular2/router';
4+
import {APP_BASE_HREF} from 'angular2/platform/common';
105

116
function checkIfWeHavePermission(instruction: ComponentInstruction) {
127
return instruction.params['id'] == '1';

modules/angular2/examples/router/ts/can_deactivate/can_deactivate_example.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import {
55
RouteConfig,
66
RouteParams,
77
ComponentInstruction,
8-
ROUTER_DIRECTIVES,
9-
APP_BASE_HREF
8+
ROUTER_DIRECTIVES
109
} from 'angular2/router';
10+
import {APP_BASE_HREF} from 'angular2/platform/common';
1111

1212
// #docregion routerCanDeactivate
1313
@Component({

modules/angular2/examples/router/ts/on_activate/on_activate_example.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
import {Component, provide} from 'angular2/core';
22
import {bootstrap} from 'angular2/platform/browser';
3-
import {
4-
OnActivate,
5-
ComponentInstruction,
6-
RouteConfig,
7-
ROUTER_DIRECTIVES,
8-
APP_BASE_HREF
9-
} from 'angular2/router';
3+
import {OnActivate, ComponentInstruction, RouteConfig, ROUTER_DIRECTIVES} from 'angular2/router';
4+
import {APP_BASE_HREF} from 'angular2/platform/common';
105

116
// #docregion routerOnActivate
127
@Component({template: `Child`})

modules/angular2/examples/router/ts/on_deactivate/on_deactivate_example.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
import {Component, Injectable, provide} from 'angular2/core';
22
import {bootstrap} from 'angular2/platform/browser';
3-
import {
4-
OnDeactivate,
5-
ComponentInstruction,
6-
RouteConfig,
7-
ROUTER_DIRECTIVES,
8-
APP_BASE_HREF
9-
} from 'angular2/router';
3+
import {OnDeactivate, ComponentInstruction, RouteConfig, ROUTER_DIRECTIVES} from 'angular2/router';
4+
import {APP_BASE_HREF} from 'angular2/platform/common';
105

116

127
@Injectable()

modules/angular2/examples/router/ts/reuse/reuse_example.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import {
55
RouteConfig,
66
ComponentInstruction,
77
ROUTER_DIRECTIVES,
8-
APP_BASE_HREF,
98
CanReuse,
109
RouteParams,
1110
OnReuse
1211
} from 'angular2/router';
12+
import {APP_BASE_HREF} from 'angular2/platform/common';
1313

1414

1515
// #docregion reuseCmp
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/**
2+
* Platform agnostic services.
3+
* Can be used both in the browser and on the server.
4+
*/
5+
export * from 'angular2/src/platform/location';

modules/angular2/platform/common_dom.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/**
2-
* This is a set of classes and objects that can be used both in the browser and on the server.
2+
* This is a set of DOM related classes and objects that can be used both in the browser and on the
3+
* server.
34
*/
45
export {DOM, setRootDomAdapter, DomAdapter} from 'angular2/src/platform/dom/dom_adapter';
56
export {DomRenderer} from 'angular2/src/platform/dom/dom_renderer';

modules/angular2/platform/testing/browser_static.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {MockAnimationBuilder} from 'angular2/src/mock/animation_builder_mock';
1414
import {MockDirectiveResolver} from 'angular2/src/mock/directive_resolver_mock';
1515
import {MockViewResolver} from 'angular2/src/mock/view_resolver_mock';
1616
import {MockLocationStrategy} from 'angular2/src/mock/mock_location_strategy';
17-
import {LocationStrategy} from 'angular2/src/router/location/location_strategy';
17+
import {LocationStrategy} from 'angular2/platform/common';
1818
import {MockNgZone} from 'angular2/src/mock/ng_zone_mock';
1919

2020
import {XHRImpl} from "angular2/src/platform/browser/xhr_impl";

modules/angular2/platform/testing/server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import {MockAnimationBuilder} from 'angular2/src/mock/animation_builder_mock';
1616
import {MockDirectiveResolver} from 'angular2/src/mock/directive_resolver_mock';
1717
import {MockViewResolver} from 'angular2/src/mock/view_resolver_mock';
1818
import {MockLocationStrategy} from 'angular2/src/mock/mock_location_strategy';
19-
import {LocationStrategy} from 'angular2/src/router/location/location_strategy';
2019
import {MockNgZone} from 'angular2/src/mock/ng_zone_mock';
2120

2221
import {TestComponentBuilder} from 'angular2/src/testing/test_component_builder';
@@ -36,6 +35,7 @@ import {
3635
ELEMENT_PROBE_PROVIDERS
3736
} from 'angular2/platform/common_dom';
3837
import {DomEventsPlugin} from 'angular2/src/platform/dom/events/dom_events';
38+
import {LocationStrategy} from 'angular2/platform/common';
3939

4040
import {CONST_EXPR} from 'angular2/src/facade/lang';
4141

0 commit comments

Comments
 (0)