【发布时间】:2016-09-23 04:18:33
【问题描述】:
我正在处理一个 gulpfile,我想在其中编译 angular 2 应用程序,但出现一些错误:
“...”类型上不存在它是什么意思,我如何使它存在?其中 nativeWindow 是 window.service.ts 如下所示:
//--------------------------------------------------------------------------------------------------
// Imports Section:
//--------------------------------------------------------------------------------------------------
import {Injectable} from 'angular2/core'
import {window} from 'angular2/src/facade/browser';
//--------------------------------------------------------------------------------------------------
// Service Class:
//--------------------------------------------------------------------------------------------------
@Injectable()
export class WindowService {
//----------------------------------------------------------------------------------------------
// Constructor Method Section:
//----------------------------------------------------------------------------------------------
constructor() { }
//----------------------------------------------------------------------------------------------
// Public Properties Section:
//----------------------------------------------------------------------------------------------
get nativeWindow(): Window {
return window;
}
}
【问题讨论】:
-
很难从你的截图中看出。
preferences是什么类型的?window也应该是你的服务? -
另外,为什么你还有一个返回
window对象的服务呢?我没有看到这个的用例。
标签: typescript angular