diff --git a/karma-js.conf.js b/karma-js.conf.js
index 17142c5d21..a36a34ba6e 100644
--- a/karma-js.conf.js
+++ b/karma-js.conf.js
@@ -87,7 +87,6 @@ module.exports = function(config) {
'dist/all/@angular/localize/schematics/**',
'dist/all/@angular/router/**/test/**',
'dist/all/@angular/platform-browser/testing/e2e_util.js',
- 'dist/all/angular1_router.js',
'dist/examples/**/e2e_test/**',
],
diff --git a/modules/angular1_router/build.js b/modules/angular1_router/build.js
deleted file mode 100644
index c9a2587d86..0000000000
--- a/modules/angular1_router/build.js
+++ /dev/null
@@ -1,118 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-'use strict';
-
-var fs = require('fs');
-var ts = require('typescript');
-
-var files = [
- 'utils.ts',
- 'url_parser.ts',
- 'lifecycle/lifecycle_annotations_impl.ts',
- 'lifecycle/route_lifecycle_reflector.ts',
- 'route_config/route_config_impl.ts',
- 'route_config/route_config_normalizer.ts',
- 'rules/route_handlers/async_route_handler.ts',
- 'rules/route_handlers/sync_route_handler.ts',
- 'rules/rules.ts',
- 'rules/rule_set.ts',
- 'rules/route_paths/route_path.ts',
- 'rules/route_paths/param_route_path.ts',
- 'rules/route_paths/regex_route_path.ts',
- 'instruction.ts',
- 'route_registry.ts',
- 'router.ts'
-];
-
-var PRELUDE = '(function(){\n';
-var POSTLUDE = '\n}());\n';
-
-function main(modulesDirectory) {
- var angular1RouterModuleDirectory = modulesDirectory + '/angular1_router';
-
- var facades = fs.readFileSync(
- angular1RouterModuleDirectory + '/lib/facades.es5', 'utf8');
- var directives = fs.readFileSync(
- angular1RouterModuleDirectory + '/src/ng_outlet.ts', 'utf8');
- var moduleTemplate = fs.readFileSync(
- angular1RouterModuleDirectory + '/src/module_template.js', 'utf8');
-
- var dir = modulesDirectory + '/angular2/src/router/';
- var sharedCode = files.reduce(function (prev, file) {
- return prev + transform(fs.readFileSync(dir + file, 'utf8'));
- }, '');
-
- // we have to use a function callback for replace to prevent it from interpreting `$`
- // as a replacement command character
- var out = moduleTemplate.replace('//{{FACADES}}', function() { return facades; })
- .replace('//{{SHARED_CODE}}', function() { return sharedCode; });
- return PRELUDE + transform(directives) + out + POSTLUDE;
-}
-
-/*
- * Given a directory name and a file's TypeScript content, return an object with the ES5 code,
- * sourcemap, and exported variable identifier name for the content.
- */
-var IMPORT_RE = new RegExp("import \\{?([\\w\\n_, ]+)\\}? from '(.+)';?", 'g');
-var INJECT_RE = new RegExp("@Inject\\(ROUTER_PRIMARY_COMPONENT\\)", 'g');
-var INJECTABLE_RE = new RegExp("@Injectable\\(\\)", 'g');
-var REQUIRE_RE = new RegExp("require\\('(.*?)'\\);", 'g');
-function transform(contents) {
- contents = contents.replace(INJECT_RE, '').replace(INJECTABLE_RE, '');
- contents = contents.replace(IMPORT_RE, function (match, imports, includePath) {
- //TODO: remove special-case
- if (isFacadeModule(includePath) || includePath === './router_outlet') {
- return '';
- }
- return match;
- });
- contents = ts.transpile(contents, {
- target: ts.ScriptTarget.ES5,
- module: ts.ModuleKind.CommonJS
- });
-
- // Rename require functions from transpiled imports
- contents = contents.replace(REQUIRE_RE, 'routerRequire(\'$1\');');
-
- return contents;
-}
-
-function isFacadeModule(modulePath) {
- return modulePath.indexOf('facade') > -1 ||
- modulePath === 'angular2/src/core/reflection/reflection';
-}
-
-module.exports = function(modulesDirectory, outputDirectory) {
- if (!fs.existsSync(outputDirectory)) {
- fs.mkdirSync(outputDirectory);
- }
- fs.writeFileSync(
- outputDirectory + '/angular_1_router.js', main(modulesDirectory));
-};
-
-// CLI entry point
-if (require.main === module) {
- try {
- var args = process.argv;
- args.shift(); // node
- args.shift(); // scriptfile.js
- if (args.length < 2) {
- // tslint:disable-next-line:no-console
- console.log("usage: $0 outFile path/to/modules");
- process.exit(1);
- }
- var outfile = args.shift();
- var directory = args.shift();
- fs.writeFileSync(outfile, main(directory));
- } catch (e) {
- // tslint:disable-next-line:no-console
- console.log(e.message);
- process.exit(1);
- }
-}
diff --git a/modules/angular1_router/index.html b/modules/angular1_router/index.html
deleted file mode 100644
index 5927dee811..0000000000
--- a/modules/angular1_router/index.html
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
- ')($rootScope);
- $rootScope.$digest();
- });
- return elt;
- }
-
- function getController(options) {
- var controller = options.controller || function () {};
- [
- '$routerOnActivate', '$routerOnDeactivate',
- '$routerOnReuse', '$routerCanReuse',
- '$routerCanDeactivate'
- ].forEach(function (hookName) {
- if (options[hookName]) {
- controller.prototype[hookName] = options[hookName];
- }
- });
- return controller;
- }
-
- function applyStaticProperties(target, options) {
- ['$canActivate', '$routeConfig'].forEach(function(property) {
- if (options[property]) {
- target[property] = options[property];
- }
- });
- }
-});
diff --git a/modules/angular1_router/test/integration/shim_spec.js b/modules/angular1_router/test/integration/shim_spec.js
deleted file mode 100644
index b70041e1ac..0000000000
--- a/modules/angular1_router/test/integration/shim_spec.js
+++ /dev/null
@@ -1,191 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-'use strict';
-
-describe('ngRoute shim', function () {
-
- var elt,
- $compile,
- $rootScope,
- $rootRouter,
- $compileProvider,
- $routeProvider;
-
- beforeEach(function () {
- module('ng');
- module('ngComponentRouter');
- module('ngRouteShim');
- module(function (_$compileProvider_, _$routeProvider_) {
- $compileProvider = _$compileProvider_;
- $routeProvider = _$routeProvider_;
- });
-
- inject(function (_$compile_, _$rootScope_, _$rootRouter_) {
- $compile = _$compile_;
- $rootScope = _$rootScope_;
- $rootRouter = _$rootRouter_;
- });
- });
-
- it('should work in a simple case', function () {
- $routeProvider.when('/', {
- controller: function OneController() {
- this.number = 'one';
- },
- controllerAs: 'oneCmp',
- template: '{{oneCmp.number}}'
- });
-
- compile('
');
-
- $rootRouter.navigateByUrl('/');
- $rootScope.$digest();
-
- expect(elt.text()).toBe('one');
- });
-
- it('should adapt routes with templateUrl', inject(function ($templateCache) {
- $routeProvider.when('/', {
- controller: function OneController() {
- this.number = 'one';
- },
- controllerAs: 'oneCmp',
- templateUrl: '/foo'
- });
-
- $templateCache.put('/foo', [200, '{{oneCmp.number}}', {}]);
-
- compile('root {
}');
-
- $rootRouter.navigateByUrl('/');
- $rootScope.$digest();
- expect(elt.text()).toBe('root {one}');
- }));
-
- it('should adapt routes using the "resolve" option', inject(function ($q) {
- $routeProvider.when('/', {
- controller: function TestController(resolvedService) {
- this.resolvedValue = resolvedService;
- },
- controllerAs: 'testCmp',
- resolve: {
- resolvedService: function () {
- return $q.when(42);
- }
- },
- template: 'value: {{testCmp.resolvedValue}}'
- });
-
- compile('
');
-
- $rootRouter.navigateByUrl('/');
- $rootScope.$digest();
-
- expect(elt.text()).toBe('value: 42');
- }));
-
- it('should adapt routes with params', function () {
- $routeProvider.when('/user/:name', {
- controller: function UserController($routeParams) {
- this.$routeParams = $routeParams;
- },
- controllerAs: 'userCmp',
- template: 'hello {{userCmp.$routeParams.name}}'
- });
- $rootScope.$digest();
-
- compile('
');
-
- $rootRouter.navigateByUrl('/user/brian');
- $rootScope.$digest();
- expect(elt.text()).toBe('hello brian');
-
- $rootRouter.navigateByUrl('/user/igor');
- $rootScope.$digest();
- expect(elt.text()).toBe('hello igor');
- });
-
- it('should adapt routes with wildcard params', function () {
- $routeProvider.when('/home/:params*', {
- controller: function UserController($routeParams) {
- this.$routeParams = $routeParams;
- },
- controllerAs: 'homeCmp',
- template: 'rest: {{homeCmp.$routeParams.params}}'
- });
- $rootScope.$digest();
-
- compile('
');
-
- $rootRouter.navigateByUrl('/home/foo/bar/123');
- $rootScope.$digest();
- expect(elt.text()).toBe('rest: foo/bar/123');
- });
-
- it('should warn about and ignore routes with optional params', function () {
- spyOn(console, 'warn');
- $routeProvider.when('/home/:params?', {
- template: 'home'
- });
- $rootScope.$digest();
-
- compile('root {
}');
-
- $rootRouter.navigateByUrl('/home/test');
- $rootScope.$digest();
- expect(elt.text()).toBe('root {}');
- expect(console.warn)
- .toHaveBeenCalledWith('Route for "/home/:params?" ignored because it has optional parameters. Skipping.',
- '(1 skipped / 0 success / 1 total)');
- });
-
- it('should adapt routes with redirects', inject(function ($location) {
- $routeProvider
- .when('/home', {
- template: 'welcome home!',
- name: 'Home'
- })
- .when('/', {
- redirectTo: '/home'
- });
- $rootScope.$digest();
-
- compile('root {
}');
-
- $rootRouter.navigateByUrl('/');
- $rootScope.$digest();
- expect(elt.text()).toBe('root {welcome home!}');
- expect($location.path()).toBe('/home');
- }));
-
- //TODO: this is broken in recognition. un-xit this when https://github.com/angular/angular/issues/4133 is fixed
- xit('should adapt "otherwise" routes', inject(function ($location) {
- $routeProvider
- .when('/home', {
- template: 'welcome home!'
- })
- .otherwise({
- redirectTo: '/home'
- });
- $rootScope.$digest();
-
- compile('root {
}');
-
- $rootRouter.navigateByUrl('/somewhere');
- $rootScope.$digest();
- expect(elt.text()).toBe('root {welcome home!}');
- expect($location.path()).toBe('/home');
- }));
-
- function compile(template) {
- elt = $compile('
' + template + '
')($rootScope);
- $rootScope.$digest();
- return elt;
- }
-});
diff --git a/modules/angular1_router/test/ng_link_spec.js b/modules/angular1_router/test/ng_link_spec.js
deleted file mode 100644
index cf8f74c477..0000000000
--- a/modules/angular1_router/test/ng_link_spec.js
+++ /dev/null
@@ -1,212 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-'use strict';
-
-describe('ngLink', function () {
-
- describe('html5Mode enabled', function () {
- runHrefTestsAndExpectPrefix('/', true);
- });
-
- describe('html5Mode disabled', function () {
- runHrefTestsAndExpectPrefix('', false, '');
- });
-
- describe('html5Mode disabled, with hash prefix', function () {
- runHrefTestsAndExpectPrefix('', false, '!');
- });
-
- describe('html5Mode enabled', function () {
- runHrefTestsAndExpectPrefix('/moo', true);
- });
-
- describe('html5Mode disabled', function () {
- runHrefTestsAndExpectPrefix('/moo', false, '');
- });
-
- describe('html5Mode disabled, with hash prefix', function () {
- runHrefTestsAndExpectPrefix('/moo', false, '!');
- });
-
- function runHrefTestsAndExpectPrefix(baseHref, html5Mode, hashPrefix) {
- var prefix = html5Mode ? '.' : '#' + hashPrefix;
-
- it('should allow linking from the parent to the child', function () {
- setup({baseHref: baseHref, html5Mode: html5Mode, hashPrefix: hashPrefix});
- configureRouter([
- { path: '/a', component: 'oneCmp' },
- { path: '/b', component: 'twoCmp', name: 'Two' }
- ]);
-
- var elt = compile('
link | outer {
}');
- navigateTo('/a');
- expect(elt.find('a').attr('href')).toBe(prefix + '/b');
- });
-
- it('should allow linking from the child and the parent', function () {
- setup({baseHref: baseHref, html5Mode: html5Mode, hashPrefix: hashPrefix});
- configureRouter([
- { path: '/a', component: 'oneCmp' },
- { path: '/b', component: 'twoCmp', name: 'Two' }
- ]);
-
- var elt = compile('outer {
}');
- navigateTo('/b');
- expect(elt.find('a').attr('href')).toBe(prefix + '/b');
- });
-
-
- it('should allow params in routerLink directive', function () {
- setup({baseHref: baseHref, html5Mode: html5Mode, hashPrefix: hashPrefix});
- registerComponent('twoLinkCmp', '
', function () {this.number = 'two';});
- configureRouter([
- { path: '/a', component: 'twoLinkCmp' },
- { path: '/b/:param', component: 'twoCmp', name: 'Two' }
- ]);
-
- var elt = compile('
');
- navigateTo('/a');
- expect(elt.find('a').attr('href')).toBe(prefix + '/b/lol');
- });
-
-
- it('should update the href of links with bound params', function () {
- setup({baseHref: baseHref, html5Mode: html5Mode, hashPrefix: hashPrefix});
- registerComponent('twoLinkCmp', '
', function () {this.number = 43;});
- configureRouter([
- { path: '/a', component: 'twoLinkCmp' },
- { path: '/b/:param', component: 'twoCmp', name: 'Two' }
- ]);
-
- var elt = compile('
');
- navigateTo('/a');
- expect(elt.find('a').text()).toBe('43');
- expect(elt.find('a').attr('href')).toBe(prefix + '/b/43');
- });
-
-
- it('should navigate on left-mouse click when a link url matches a route', function () {
- setup({baseHref: baseHref, html5Mode: html5Mode, hashPrefix: hashPrefix});
- configureRouter([
- { path: '/', component: 'oneCmp' },
- { path: '/two', component: 'twoCmp', name: 'Two'}
- ]);
-
- var elt = compile('
link |
');
- expect(elt.text()).toBe('link | one');
- expect(elt.find('a').attr('href')).toBe(prefix + '/two');
-
- elt.find('a')[0].click();
- inject(function($rootScope) { $rootScope.$digest(); });
- expect(elt.text()).toBe('link | two');
- });
-
-
- it('should not navigate on non-left mouse click when a link url matches a route', function() {
- setup({baseHref: baseHref, html5Mode: html5Mode, hashPrefix: hashPrefix});
- configureRouter([
- { path: '/', component: 'oneCmp' },
- { path: '/two', component: 'twoCmp', name: 'Two'}
- ]);
-
- var elt = compile('
link |
');
- expect(elt.text()).toBe('link | one');
- elt.find('a').triggerHandler({ type: 'click', which: 3 });
- inject(function($rootScope) { $rootScope.$digest(); });
- expect(elt.text()).toBe('link | one');
- });
-
-
- // See https://github.com/angular/router/issues/206
- it('should not navigate a link without an href', function () {
- setup({baseHref: baseHref, html5Mode: html5Mode, hashPrefix: hashPrefix});
- configureRouter([
- { path: '/', component: 'oneCmp' },
- { path: '/two', component: 'twoCmp', name: 'Two'}
- ]);
- expect(function () {
- var elt = compile('
link');
- expect(elt.text()).toBe('link');
- elt.find('a')[0].click();
- inject(function($rootScope) { $rootScope.$digest(); });
- }).not.toThrow();
- });
-
- it('should add an ng-link-active class on the current link', function() {
- setup({baseHref: baseHref, html5Mode: html5Mode, hashPrefix: hashPrefix});
- configureRouter([
- { path: '/', component: 'oneCmp', name: 'One' }
- ]);
-
- var elt = compile('
one |
');
- navigateTo('/');
- expect(elt.find('a').attr('class')).toBe('ng-link-active');
- });
-
- it('should not add a href if link attributes are undefined', function () {
- setup({baseHref: baseHref, html5Mode: html5Mode, hashPrefix: hashPrefix});
- configureRouter([
- { path: '/a', component: 'oneCmp' },
- { path: '/b', component: 'twoCmp', name: 'Two' }
- ]);
-
- var elt = compile('
link | outer {
}');
- navigateTo('/a');
- expect(elt.find('a').hasAttr('href')).toBeFalsy();
- });
- }
-
- function registerComponent(name, template, controller) {
- module(function($compileProvider) {
- $compileProvider.component(name, {
- template: template,
- controller: controller
- });
- });
- }
-
- function setup(config) {
- module(function($provide) {
- $provide.decorator('$browser', function($delegate) {
- $delegate.baseHref = function() { return config.baseHref; };
- return $delegate;
- });
- });
- module('ngComponentRouter');
- module(function($locationProvider) {
- $locationProvider.html5Mode(config.html5Mode);
- $locationProvider.hashPrefix(config.hashPrefix);
- });
- registerComponent('userCmp', '
hello {{$ctrl.$routeParams.name}}
', function () {});
- registerComponent('oneCmp', '
{{$ctrl.number}}
', function () {this.number = 'one';});
- registerComponent('twoCmp', '
', function () {this.number = 'two';});
- }
-
- function configureRouter(routeConfig) {
- inject(function($rootRouter) {
- $rootRouter.config(routeConfig);
- });
- }
-
- function compile(template) {
- var elt;
- inject(function($compile, $rootScope) {
- elt = $compile('
' + template + '
')($rootScope);
- $rootScope.$digest();
- });
- return elt;
- }
-
- function navigateTo(url) {
- inject(function($rootRouter, $rootScope) {
- $rootRouter.navigateByUrl(url);
- $rootScope.$digest();
- });
- }
-});
diff --git a/modules/angular1_router/test/util.es5.js b/modules/angular1_router/test/util.es5.js
deleted file mode 100644
index 0ed620c469..0000000000
--- a/modules/angular1_router/test/util.es5.js
+++ /dev/null
@@ -1,88 +0,0 @@
-/**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
-/*
- * Helpers to keep tests DRY
- */
-
-function componentTemplatePath(name) {
- return './components/' + dashCase(name) + '/' + dashCase(name) + '.html';
-}
-
-function componentControllerName(name) {
- return name[0].toUpperCase() + name.substr(1) + 'Controller';
-}
-
-function dashCase(str) {
- return str.replace(/([A-Z])/g, function ($1) {
- return '-' + $1.toLowerCase();
- });
-}
-
-
-function provideHelpers(fn, preInject) {
- return function () {
- var elt,
- $compile,
- $rootScope,
- $rootRouter,
- $templateCache,
- $controllerProvider;
-
- module('ng');
- module('ngNewRouter');
- module(function(_$controllerProvider_) {
- $controllerProvider = _$controllerProvider_;
- });
-
- inject(function(_$compile_, _$rootScope_, _$rootRouter_, _$templateCache_) {
- $compile = _$compile_;
- $rootScope = _$rootScope_;
- $rootRouter = _$rootRouter_;
- $templateCache = _$templateCache_;
- });
-
- function registerComponent(name, template, config) {
- if (!template) {
- template = '';
- }
- var ctrl;
- if (!config) {
- ctrl = function () {};
- } else if (angular.isArray(config)) {
- ctrl = function () {};
- ctrl.$routeConfig = config;
- } else if (typeof config === 'function') {
- ctrl = config;
- } else {
- ctrl = function () {};
- ctrl.prototype = config;
- }
- $controllerProvider.register(componentControllerName(name), ctrl);
- put(name, template);
- }
-
-
- function put (name, template) {
- $templateCache.put(componentTemplatePath(name), [200, template, {}]);
- }
-
- function compile(template) {
- var elt = $compile('
' + template + '
')($rootScope);
- $rootScope.$digest();
- return elt;
- }
-
- fn({
- registerComponent: registerComponent,
- $rootRouter: $rootRouter,
- put: put,
- compile: compile
- });
- };
-}
diff --git a/modules/tsconfig.json b/modules/tsconfig.json
index 67c1ff7253..03c7961d56 100644
--- a/modules/tsconfig.json
+++ b/modules/tsconfig.json
@@ -23,7 +23,6 @@
"types": ["angular"]
},
"exclude": [
- "angular1_router",
"benchmarks_external",
"payload_tests",
"playground/",