无法找到名称' ChangeDetectorRef'在Angular 4中

时间:2017-04-26 07:49:39

标签: angular ionic-framework typescript2.0 ionic3

我正在使用Angular 4将Ionic 2应用程序迁移到Ionic 3。

import { Component, Input, Output, OnInit, Inject, AfterViewInit, forwardRef, EventEmitter, ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core';

[...]

  constructor( @Inject(forwardRef(() => TimelineComponent)) private _parent: TimelineComponent, private cd: ChangeDetectorRef) {
    this.window = <Window>window;
}

我收到错误:在此构造函数中找不到名称&#39; ChangeDetectorRef :(

这是我的package.json:

"dependencies": {
"@angular/animations": "4.0.0",
"@angular/common": "4.0.0",
"@angular/compiler": "4.0.0",
"@angular/compiler-cli": "4.0.0",
"@angular/core": "4.0.0",
"@angular/forms": "4.0.0",
"@angular/http": "4.0.0",
"@angular/platform-browser": "4.0.0",
"@angular/platform-browser-dynamic": "4.0.0",
"@angular/platform-server": "4.0.0",
"@ionic-native/core": "3.4.2",
"@ionic-native/splash-screen": "3.4.2",
"@ionic-native/status-bar": "3.4.2",
"@ionic/storage": "2.0.1",
"@ngx-translate/core": "^6.0.1",
"@ngx-translate/http-loader": "0.0.3",
"install": "^0.8.8",
"intl": "^1.2.5",
"ionic-angular": "3.0.1",
"ionicons": "3.0.0",
"lodash": "^4.17.3",
"npm": "^4.5.0",
"pdfmake": "0.1.26",
"rxjs": "5.1.1",
"smoothscroll-polyfill": "0.3.4",
"sw-toolbox": "3.4.0",
"typings": "2.1.1",
"zone.js": "^0.8.4"  },
"devDependencies": {
"@ionic/app-scripts": "1.3.0",
"typescript": "~2.2.1",
"gulp": "^3.9.1",
"gulp-help": "^1.6.1",
"gulp-inject-string": "^1.1.0",
"gulp-load-plugins": "^1.4.0",
"gulp-replace-task": "^0.11.0",
"gulp-war": "^0.1.4",
"gulp-zip": "^4.0.0"

},

这是我在Chrome中的错误 Here my errors in Chrome

1 个答案:

答案 0 :(得分:0)

我升级了新版本,现在可以使用了:)

while (true)