【发布时间】:2016-08-16 08:00:21
【问题描述】:
我正在使用 angular beta .8,我正在使用 gulp 尝试将我的应用部署到 apache http 服务器。
我有一个这样的 .ts 文件:
import {Component, OnInit} from 'angular2/core';
export class Calendar implements OnInit {
date: any;
ngOnInit() {
$('.datepicker').pickadate({
当我尝试启动“gulp”命令时,它显示了多个错误,目前我正在尝试解决这些错误:
error TS2304: Cannot find name '$'.
我不知道如何为转译器提供此功能,并且在环顾四周时,我发现了两个解决方案分支:将 /// <reference path="../node_modules/angular2/typings/browser.d.ts" /> 添加到我拥有引导程序的位置,我已经这样做了,并添加了我目前拥有的类型像这样:
{
"ambientDependencies": {
"es6-shim": "github:DefinitelyTyped/DefinitelyTyped/es6-shim/es6-shim.d.ts#4de74cb527395c13ba20b438c3a7a419ad931f1c",
"jasmine": "github:DefinitelyTyped/DefinitelyTyped/jasmine/jasmine.d.ts#bc92442c075929849ec41d28ab618892ba493504"
},
"globalDependencies": {
"es6-collections": "registry:dt/es6-collections#0.5.1+20160316155526",
"es6-promise": "registry:dt/es6-promise#0.0.0+20160614011821"
}
}
它什么也没解决,所以我想知道我还需要什么才能使这些错误消失。
我还有其他错误,我不确定它们是否相关,主要是抱怨找不到名称“Observable”、“OnInit”、我在 .ts 文件中引用的几个 .js 函数,以及几个
TS2307 cannot find module 'ng2-material/all'
或似乎找不到的其他打字稿文件。
我想提一下,如果在 plunker 或浏览器中执行代码确实可以工作,但在尝试使用 gulp 部署它时却无法正常工作。
我已阅读此主题并应用了所有内容,但正如我所说,它对我不起作用Angular 2 typescript can't find names
【问题讨论】:
标签: javascript jquery angular gulp