【问题标题】:Socially tutorial (Angular2 + Meteor)社交教程(Angular2 + Meteor)
【发布时间】:2016-06-23 11:29:46
【问题描述】:

网址:http://www.angular-meteor.com/tutorials/socially/angular2/search-sort-pagination-and-reactive-vars

当我按照第 12.4 节的教程进行操作时,编译器总是抱怨: [web.browser] client/parties-list/parties-list.ts (28, 40): 找不到名称 'ReactiveVar

然后,我在命令行中输入“meteor list”,得到以下信息:


accounts-password                1.1.4  Password support for accounts

anti:fake                        0.4.1  Random text and data generator

barbatus:ng2-meteor-accounts     0.1.6  Meteor Accounts for Angular2

barbatus:ng2-meteor-accounts-ui  0.1.3  Meteor Accounts UI for Angular2

barbatus:ng2-pagination          0.1.3  Angular2 Pagination Components

es5-shim                         4.1.14  Shims and polyfills to improve ECMAScr...

jquery                           1.11.4  Manipulate the DOM using CSS selectors

meteor-base                      1.0.1  Packages that every Meteor app needs

mobile-experience                1.0.1  Packages for a great mobile user experi...

mongo                            1.1.3  Adaptor for using MongoDB and Minimongo...

reactive-var                     1.0.6  Reactive variable

session                          1.1.1  Session variable

standard-minifiers               1.0.2  Standard minifiers used with Meteor app...

tracker                          1.0.9  Dependency tracker to allow reactive ca...

urigo:angular2-meteor            0.4.4  Angular2 and Meteor integration

reactive-var 已明确安装。但是为什么编译器仍然抱怨找不到'ReactiveVar'?

【问题讨论】:

  • 教程链接应该如何提供帮助?可能你犯了一些错误。任何人都将如何使用该链接找到答案。请将代码添加到您的问题中,以便重现问题。

标签: meteor typescript angular angular2-meteor


【解决方案1】:

确保您的输入正确引用并且是最新的。 我正在使用 Meteor 1.2.1 和 ionic2-meteor,所以我有一个 typings 文件夹。

确保您安装了 Typings NPM 模块。

npm install typings -g

然后安装流星的类型

  typings install meteor --ambient

  typings install es6-promise --ambient

  typings install es6-shim --ambient

在您的 tsconfig.json 中包含 main.d.ts 文件

"typings": [
      "typings/ionic2-meteor/ionic-framework/ionic.d.ts",
      "typings/ionic2-meteor/ionic2-meteor.d.ts",
      "typings/angular2-meteor/angular2-meteor.d.ts",
      "typings/main.d.ts"
    ]

确保安装的 meteor.d.ts 文件包含以下内容:

declare var ReactiveVar: ReactiveVarStatic;
interface ReactiveVarStatic {
    new<T>(initialValue: T, equalsFunc?: Function): ReactiveVar<T>;
}
interface ReactiveVar<T> {
    get(): T;
    set(newValue: T): void;
}

就我而言,我必须更新我的 meteor.d.ts 文件(主文件和浏览器),因为它们不包含 ReactiveVar 声明和接口。

【讨论】:

    猜你喜欢
    • 2016-10-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-02-04
    • 2018-06-18
    • 2016-08-05
    • 1970-01-01
    相关资源
    最近更新 更多