angular-meteor - angular2-meteor-auto-bootstrap 错误 - 未找到指令注释
angular-meteor - Error with angular2-meteor-auto-bootstrap - No Directive annotation found on
我在 angular-meteor 教程的第 3 步中遇到错误 (here)
当我尝试这样做时:
import {bootstrap} from 'angular2-meteor-auto-bootstrap';
bootstrap(Socially);
我在浏览器上收到此错误:
EXCEPTION: No Directive annotation found on Socially
这是我的代码:
client/app.ts
import 'reflect-metadata';
import 'zone.js/dist/zone';
import {Component} from 'angular2/core';
import {bootstrap} from 'angular2-meteor-auto-bootstrap';
import {Parties} from '../collections/parties';
import {Tracker} from 'meteor/tracker';
import {Mongo} from "meteor/mongo";
@Component({
selector: 'app',
templateUrl: 'client/app.html'
})
class Socially {
parties: Mongo.Cursor<Object>;
constructor () {
this.parties = Parties.find();
}
}
bootstrap(Socially);
client/app.html
<p>Liste of parties:</p>
<div>
<ul>
<li *ngFor="let party of parties">
{{party.name}}
<p>{{party.description}}</p>
<p>{{party.location}}</p>
</li>
</ul>
</div>
collections/parties.ts
import {Mongo} from 'meteor/mongo';
export let Parties = new Mongo.Collection('parties');
server/main.ts
import {loadParties} from './load-parties';
import {Meteor} from 'meteor/meteor';
Meteor.startup(loadParties);
server/load-parties.ts
import {Parties} from '../collections/parties';
export function loadParties() {
if (Parties.find().count() === 0) {
var parties = [
{
'name': 'Dubstep-Free Zone',
'description': 'Can we please just for an evening not listen to dubstep.',
'location': 'Palo Alto'
},
{
'name': 'All dubstep all the time',
'description': 'Get it on!',
'location': 'Palo Alto'
},
{
'name': 'Savage lounging',
'description': 'Leisure suit required. And only fiercest manners.',
'location': 'San Francisco'
}
];
for (var i = 0; i < parties.length; i++) {
Parties.insert(parties[i]);
}
}
};
这是我的配置:
package.json
{
"name": "socially",
"private": true,
"scripts": {
"start": "meteor run"
},
"dependencies": {
"angular2": "2.0.0-rc.1",
"angular2-google-maps": "0.9.0",
"angular2-meteor": "^0.5.5",
"angular2-meteor-accounts-ui": "0.3.5",
"angular2-meteor-auto-bootstrap": "^0.5.5",
"angular2-pagination": "0.1.1",
"collections": "^3.0.0",
"ionic-webpack-package": "^1.0.0",
"meteor-node-stubs": "^0.2.3",
"ng2-material": "0.2.12",
"reflect-metadata": "^0.1.2",
"rxjs": "5.0.0-beta.6"
}
}
tsconfig.json
{
"compilerOptions": {
"experimentalDecorators": true,
"module": "commonjs",
"target": "es5",
"isolatedModules": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"removeComments": false,
"noImplicitAny": false,
"sourceMap": true
},
"filesGlob": [
"client/**/*.ts",
"server/**/*.ts",
"typings/**/*.d.ts"
],
"exclude": [
"node_modules"
]
}
typings.json
{
"name": "socially",
"version": false,
"dependencies": {
"es6-promise": "registry:npm/es6-promise#3.0.0+20160211003958"
},
"ambientDependencies": {
"es6-shim": "registry:dt/es6-shim#0.31.2+20160317120654"
}
}
最后,这是我使用的命令:
meteor create socially
cd socially
meteor npm install --save meteor-node-stubs angular2
meteor add angular2-compilers
meteor add barbatus:angular2-runtime
meteor npm install --save angular2-meteor
meteor remove blaze-html-templates
npm install typings -g
typings init
typings install es6-promise --save
typings install es6-shim --ambient --save
typings install registry:env/meteor --ambient
meteor npm install angular2-meteor-auto-bootstrap --save
我的工具版本:
npm -v
3.8.6
meteor --version
Meteor 1.3.2.4
meteor list
angular2-compilers 0.5.6
autopublish 1.0.7
barbatus:angular2-runtime 0.2.3_2
ecmascript 0.4.3
es5-shim 4.5.10
insecure 1.0.7
jquery 1.11.8
meteor-base 1.0.4
mobile-experience 1.0.4
mongo 1.1.7
reactive-var 1.0.9
standard-minifier-css 1.0.6
standard-minifier-js 1.0.6
tracker 1.0.13
我正在研究 Windows 8.
我搜索了几天的解决方案,但我找不到!
感谢您的帮助。
这是由于对 beta17 和 RC1 的引用。这是 temporary fix,直到它在 angular-meteor 中解决。
我在 angular-meteor 教程的第 3 步中遇到错误 (here)
当我尝试这样做时:
import {bootstrap} from 'angular2-meteor-auto-bootstrap';
bootstrap(Socially);
我在浏览器上收到此错误:
EXCEPTION: No Directive annotation found on Socially
这是我的代码:
client/app.ts
import 'reflect-metadata';
import 'zone.js/dist/zone';
import {Component} from 'angular2/core';
import {bootstrap} from 'angular2-meteor-auto-bootstrap';
import {Parties} from '../collections/parties';
import {Tracker} from 'meteor/tracker';
import {Mongo} from "meteor/mongo";
@Component({
selector: 'app',
templateUrl: 'client/app.html'
})
class Socially {
parties: Mongo.Cursor<Object>;
constructor () {
this.parties = Parties.find();
}
}
bootstrap(Socially);
client/app.html
<p>Liste of parties:</p>
<div>
<ul>
<li *ngFor="let party of parties">
{{party.name}}
<p>{{party.description}}</p>
<p>{{party.location}}</p>
</li>
</ul>
</div>
collections/parties.ts
import {Mongo} from 'meteor/mongo';
export let Parties = new Mongo.Collection('parties');
server/main.ts
import {loadParties} from './load-parties';
import {Meteor} from 'meteor/meteor';
Meteor.startup(loadParties);
server/load-parties.ts
import {Parties} from '../collections/parties';
export function loadParties() {
if (Parties.find().count() === 0) {
var parties = [
{
'name': 'Dubstep-Free Zone',
'description': 'Can we please just for an evening not listen to dubstep.',
'location': 'Palo Alto'
},
{
'name': 'All dubstep all the time',
'description': 'Get it on!',
'location': 'Palo Alto'
},
{
'name': 'Savage lounging',
'description': 'Leisure suit required. And only fiercest manners.',
'location': 'San Francisco'
}
];
for (var i = 0; i < parties.length; i++) {
Parties.insert(parties[i]);
}
}
};
这是我的配置:
package.json
{
"name": "socially",
"private": true,
"scripts": {
"start": "meteor run"
},
"dependencies": {
"angular2": "2.0.0-rc.1",
"angular2-google-maps": "0.9.0",
"angular2-meteor": "^0.5.5",
"angular2-meteor-accounts-ui": "0.3.5",
"angular2-meteor-auto-bootstrap": "^0.5.5",
"angular2-pagination": "0.1.1",
"collections": "^3.0.0",
"ionic-webpack-package": "^1.0.0",
"meteor-node-stubs": "^0.2.3",
"ng2-material": "0.2.12",
"reflect-metadata": "^0.1.2",
"rxjs": "5.0.0-beta.6"
}
}
tsconfig.json
{
"compilerOptions": {
"experimentalDecorators": true,
"module": "commonjs",
"target": "es5",
"isolatedModules": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"removeComments": false,
"noImplicitAny": false,
"sourceMap": true
},
"filesGlob": [
"client/**/*.ts",
"server/**/*.ts",
"typings/**/*.d.ts"
],
"exclude": [
"node_modules"
]
}
typings.json
{
"name": "socially",
"version": false,
"dependencies": {
"es6-promise": "registry:npm/es6-promise#3.0.0+20160211003958"
},
"ambientDependencies": {
"es6-shim": "registry:dt/es6-shim#0.31.2+20160317120654"
}
}
最后,这是我使用的命令:
meteor create socially
cd socially
meteor npm install --save meteor-node-stubs angular2
meteor add angular2-compilers
meteor add barbatus:angular2-runtime
meteor npm install --save angular2-meteor
meteor remove blaze-html-templates
npm install typings -g
typings init
typings install es6-promise --save
typings install es6-shim --ambient --save
typings install registry:env/meteor --ambient
meteor npm install angular2-meteor-auto-bootstrap --save
我的工具版本:
npm -v
3.8.6
meteor --version
Meteor 1.3.2.4
meteor list
angular2-compilers 0.5.6
autopublish 1.0.7
barbatus:angular2-runtime 0.2.3_2
ecmascript 0.4.3
es5-shim 4.5.10
insecure 1.0.7
jquery 1.11.8
meteor-base 1.0.4
mobile-experience 1.0.4
mongo 1.1.7
reactive-var 1.0.9
standard-minifier-css 1.0.6
standard-minifier-js 1.0.6
tracker 1.0.13
我正在研究 Windows 8.
我搜索了几天的解决方案,但我找不到!
感谢您的帮助。
这是由于对 beta17 和 RC1 的引用。这是 temporary fix,直到它在 angular-meteor 中解决。