我找不到名字'通过将导入的名称插入构造函数的参数中将服务注入到类中时出错。这已经发生在我身上几次,我无法弄清楚是什么解决了它。任何关于此的光线都将非常受欢迎。这是我的例子:
import { Component } from '@angular/core';
import { Injectable } from '@angular/core';
import { Http, Response } from '@angular/http';
import { _ } from 'lodash';
import { RatesService } from '../../services/RatesService';
import { NavController } from 'ionic-angular';
import { Currencies } from '../../models/currencies.ts';
@Component({
selector: 'page-rates',
templateUrl: 'rates.html'
})
export class Rates {
constructor(public navCtrl: NavController,
private ratesService: RatesService,
private currencies: Currencies) { }
}
'货币'导致错误
答案 0 :(得分:3)
typescript编译器给我们一个误导性的错误字符串。
变化:
import { Currencies } from '../../models/currencies.ts';
到
import { Currencies } from '../../models/currencies';