X Tutup
Skip to content

Commit c5294c7

Browse files
committed
Revert "refactor(router): improve recognition and generation pipeline"
This reverts commit cf7292f. This commit triggered an existing race condition in Google code. More work is needed on the Router to fix this condition before this refactor can land.
1 parent ba64b5e commit c5294c7

Some content is hidden

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

41 files changed

+1090
-2943
lines changed

modules/angular1_router/build.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@ var ts = require('typescript');
66
var files = [
77
'lifecycle_annotations_impl.ts',
88
'url_parser.ts',
9-
'route_recognizer.ts',
9+
'path_recognizer.ts',
1010
'route_config_impl.ts',
1111
'async_route_handler.ts',
1212
'sync_route_handler.ts',
13-
'component_recognizer.ts',
13+
'route_recognizer.ts',
1414
'instruction.ts',
15-
'path_recognizer.ts',
1615
'route_config_nomalizer.ts',
1716
'route_lifecycle_reflector.ts',
1817
'route_registry.ts',

modules/angular1_router/lib/facades.es5

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,6 @@ var StringMapWrapper = {
173173

174174
var List = Array;
175175
var ListWrapper = {
176-
clear: function (l) {
177-
l.length = 0;
178-
},
179-
180176
create: function () {
181177
return [];
182178
},

modules/angular1_router/src/module_template.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ function routerFactory($q, $location, $$directiveIntrospector, $browser, $rootSc
3131
// property in a route config
3232
exports.assertComponentExists = function () {};
3333

34-
angular.stringifyInstruction = function (instruction) {
35-
return instruction.toRootUrl();
36-
};
34+
angular.stringifyInstruction = exports.stringifyInstruction;
3735

3836
var RouteRegistry = exports.RouteRegistry;
3937
var RootRouter = exports.RootRouter;

modules/angular1_router/src/ng_route_shim.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
routeMap[path] = routeCopy;
111111

112112
if (route.redirectTo) {
113-
routeDefinition.redirectTo = [routeMap[route.redirectTo].name];
113+
routeDefinition.redirectTo = route.redirectTo;
114114
} else {
115115
if (routeCopy.controller && !routeCopy.controllerAs) {
116116
console.warn('Route for "' + path + '" should use "controllerAs".');
@@ -123,7 +123,7 @@
123123
}
124124

125125
routeDefinition.component = directiveName;
126-
routeDefinition.name = route.name || upperCase(directiveName);
126+
routeDefinition.as = upperCase(directiveName);
127127

128128
var directiveController = routeCopy.controller;
129129

modules/angular1_router/test/integration/navigation_spec.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@ describe('navigation', function () {
113113
});
114114

115115

116-
it('should work with recursive nested outlets', function () {
116+
// TODO: fix this
117+
xit('should work with recursive nested outlets', function () {
117118
registerComponent('recurCmp', {
118119
template: '<div>recur { <div ng-outlet></div> }</div>',
119120
$routeConfig: [
@@ -151,8 +152,8 @@ describe('navigation', function () {
151152
compile('<div ng-outlet></div>');
152153

153154
$router.config([
154-
{ path: '/', redirectTo: ['/User'] },
155-
{ path: '/user', component: 'userCmp', name: 'User' }
155+
{ path: '/', redirectTo: '/user' },
156+
{ path: '/user', component: 'userCmp' }
156157
]);
157158

158159
$router.navigateByUrl('/');
@@ -166,15 +167,16 @@ describe('navigation', function () {
166167
registerComponent('childRouter', {
167168
template: '<div>inner { <div ng-outlet></div> }</div>',
168169
$routeConfig: [
169-
{ path: '/new-child', component: 'oneCmp', name: 'NewChild'},
170-
{ path: '/new-child-two', component: 'twoCmp', name: 'NewChildTwo'}
170+
{ path: '/old-child', redirectTo: '/new-child' },
171+
{ path: '/new-child', component: 'oneCmp'},
172+
{ path: '/old-child-two', redirectTo: '/new-child-two' },
173+
{ path: '/new-child-two', component: 'twoCmp'}
171174
]
172175
});
173176

174177
$router.config([
175-
{ path: '/old-parent/old-child', redirectTo: ['/NewParent', 'NewChild'] },
176-
{ path: '/old-parent/old-child-two', redirectTo: ['/NewParent', 'NewChildTwo'] },
177-
{ path: '/new-parent/...', component: 'childRouter', name: 'NewParent' }
178+
{ path: '/old-parent', redirectTo: '/new-parent' },
179+
{ path: '/new-parent/...', component: 'childRouter' }
178180
]);
179181

180182
compile('<div ng-outlet></div>');

modules/angular1_router/test/integration/shim_spec.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,11 @@ describe('ngRoute shim', function () {
139139

140140
it('should adapt routes with redirects', inject(function ($location) {
141141
$routeProvider
142-
.when('/home', {
143-
template: 'welcome home!',
144-
name: 'Home'
145-
})
146142
.when('/', {
147143
redirectTo: '/home'
144+
})
145+
.when('/home', {
146+
template: 'welcome home!'
148147
});
149148
$rootScope.$digest();
150149

modules/angular2/src/router/async_route_handler.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,13 @@
1+
import {RouteHandler} from './route_handler';
12
import {Promise, PromiseWrapper} from 'angular2/src/facade/async';
23
import {isPresent, Type} from 'angular2/src/facade/lang';
34

4-
import {RouteHandler} from './route_handler';
5-
import {RouteData, BLANK_ROUTE_DATA} from './instruction';
6-
7-
85
export class AsyncRouteHandler implements RouteHandler {
96
/** @internal */
107
_resolvedComponent: Promise<any> = null;
118
componentType: Type;
12-
public data: RouteData;
139

14-
constructor(private _loader: Function, data: {[key: string]: any} = null) {
15-
this.data = isPresent(data) ? new RouteData(data) : BLANK_ROUTE_DATA;
16-
}
10+
constructor(private _loader: Function, public data?: {[key: string]: any}) {}
1711

1812
resolveComponentType(): Promise<any> {
1913
if (isPresent(this._resolvedComponent)) {

modules/angular2/src/router/component_recognizer.ts

Lines changed: 0 additions & 157 deletions
This file was deleted.

0 commit comments

Comments
 (0)
X Tutup