在angular2中迁移到RC4之后的问题

Kri*_*nan 2 angular2-routing angular

从Beta-17迁移到RC4后,我遇到的问题很少.我收到以下编译错误

引导错误

/// < reference path="../node_modules/angular2-in-memory-web-api/typings/browser.d.ts" >
import {bootstrap} from '@angular/platform-browser';
Error: Module "../platform-browser/index" as no exported member bootstrap
Run Code Online (Sandbox Code Playgroud)

路由器错误

import {ROUTER_PROVIDERS, RouteConfig, ROUTER_DIRECTIVES, RouteParams, ROUTER_BINDINGS} from '@angular/router';
Error: Cannot find module '@angular/router'
Run Code Online (Sandbox Code Playgroud)

我尝试使用路由器也弃用了,仍然发现模块未找到错误

import {ROUTER_PROVIDERS, RouteConfig, ROUTER_DIRECTIVES, RouteParams, ROUTER_BINDINGS} from '@angular/router-deprecated';
Error: Cannot find module '@angular/router-deprecated'
Run Code Online (Sandbox Code Playgroud)

如果不推荐使用现有路由器,那么实现路由的新方法是什么?

我在以下文档中验证了URL,但没有注意到很多区别.

任何人都可以对此有所了解吗?

根据评论更新:新的错误集

我现在可以导入bootstrap和路由器,但是我收到了一些其他错误

错误#1.无法导入RouteConfig

import { ROUTER_DIRECTIVES, RouterOutlet, RouteConfig } from '@angular/router';
Error: Module "../angular/router/index has no exported member RouteConfig"
Run Code Online (Sandbox Code Playgroud)

为了使路由器不再使用,即我现有的路由实现,我需要导入RouteConfig.我不确定从哪里可以导入RouteConfig

  1. 除此之外,我得到了近210个编译错误,如下所示.当我搜索以下错误时,建议添加以下行

    /// ../node_modules/angular2/typings/browser.d.ts"/>

但作为迁移的一部分,我已添加以下行

/// < reference path="../node_modules/angular2-in-memory-web-api/typings/browser.d.ts" >
Run Code Online (Sandbox Code Playgroud)

错误:

Error   TS2304  Cannot find name 'Promise'. TypeScript Virtual Projects ..\node_modules\@angular\core\src\facade\async.d.ts 34  Active
Error   TS2304  Cannot find name 'Promise'. TypeScript Virtual Projects ..\node_modules\@angular\core\src\facade\async.d.ts 35  Active
Error   TS2304  Cannot find name 'Promise'. TypeScript Virtual Projects ..\node_modules\@angular\core\src\facade\promise.d.ts   9   Active
Error   TS2304  Cannot find name 'Promise'. TypeScript Virtual Projects ..\node_modules\@angular\core\src\facade\promise.d.ts   15  Active
Error   TS2304  Cannot find name 'Promise'. TypeScript Virtual Projects ..\node_modules\@angular\core\src\facade\promise.d.ts   16  Active
Error   TS2304  Cannot find name 'Promise'. TypeScript Virtual Projects ..\node_modules\@angular\core\src\facade\promise.d.ts   17  Active
Error   TS2304  Cannot find name 'Promise'. TypeScript Virtual Projects ..\node_modules\@angular\core\src\facade\promise.d.ts   17  Active
Error   TS2304  Cannot find name 'Promise'. TypeScript Virtual Projects ..\node_modules\@angular\core\src\facade\promise.d.ts   18  Active
Error   TS2304  Cannot find name 'Promise'. TypeScript Virtual Projects ..\node_modules\@angular\core\src\facade\promise.d.ts   18  Active
Error   TS2304  Cannot find name 'Promise'. TypeScript Virtual Projects ..\node_modules\@angular\core\src\facade\promise.d.ts   19  Active
Error   TS2304  Cannot find name 'Promise'. TypeScript Virtual Projects ..\node_modules\@angular\core\src\facade\promise.d.ts   19  Active
Error   TS2304  Cannot find name 'Promise'. TypeScript Virtual Projects ..\node_modules\@angular\core\src\facade\promise.d.ts   20  Active


Error   TS2664  Invalid module name in augmentation, module '../../Observable' cannot be found. TypeScript Virtual Projects ..\node_modules\rxjs\add\operator\repeat.d.ts   2   Active
Error   TS2664  Invalid module name in augmentation, module '../../Observable' cannot be found. TypeScript Virtual Projects ..\node_modules\rxjs\add\operator\retry.d.ts    2   Active
Error   TS2664  Invalid module name in augmentation, module '../../Observable' cannot be found. TypeScript Virtual Projects ..\node_modules\rxjs\add\operator\retryWhen.d.ts    2   Active
Error   TS2664  Invalid module name in augmentation, module '../../Observable' cannot be found. TypeScript Virtual Projects ..\node_modules\rxjs\add\operator\sample.d.ts   2   Active
Error   TS2664  Invalid module name in augmentation, module '../../Observable' cannot be found. TypeScript Virtual Projects ..\node_modules\rxjs\add\operator\sampleTime.d.ts   2   Active
Error   TS2664  Invalid module name in augmentation, module '../../Observable' cannot be found. TypeScript Virtual Projects ..\node_modules\rxjs\add\operator\scan.d.ts 2   Active
Error   TS2664  Invalid module name in augmentation, module '../../Observable' cannot be found. TypeScript Virtual Projects ..\node_modules\rxjs\add\operator\share.d.ts    2   Active
Error   TS2664  Invalid module name in augmentation, module '../../Observable' cannot be found. TypeScript Virtual Projects ..\node_modules\rxjs\add\operator\single.d.ts   2   Active
Error   TS2664  Invalid module name in augmentation, module '../../Observable' cannot be found. TypeScript Virtual Projects ..\node_modules\rxjs\add\operator\skip.d.ts 2   Active
Error   TS2664  Invalid module name in augmentation, module '../../Observable' cannot be found. TypeScript Virtual Projects ..\node_modules\rxjs\add\operator\skipUntil.d.ts    2   Active
Error   TS2664  Invalid module name in augmentation, module '../../Observable' cannot be found. TypeScript Virtual Projects ..\node_modules\rxjs\add\operator\skipWhile.d.ts    2   Active
Error   TS2664  Invalid module name in augmentation, module '../../Observable' cannot be found. TypeScript Virtual Projects ..\node_modules\rxjs\add\operator\startWith.d.ts    2   Active
Error   TS2664  Invalid module name in augmentation, module '../../Observable' cannot be found. TypeScript Virtual Projects ..\node_modules\rxjs\add\operator\subscribeOn.d.ts  2   Active
Run Code Online (Sandbox Code Playgroud)

Deb*_*ahK 5

除了Ian的伟大建议之外,我还有一个示例应用程序,我刚刚转换为RC 4可能有所帮助.你可以在这里找到它.

这是具有相关更改的提交.