繁体   English   中英

Angular2-Meteor:如何在应用外重用组件

[英]Angular2-Meteor: how to re-use components outside my app

我一直在遵循使用Angular2-Meteor创建演示应用程序的教程。

链接到教程: http : //www.angular-meteor.com/tutorials/socially/

我有一个外部网页,我想在其中使用该应用程序中的某些组件。

这是来自教程的PartnersList组件声明:

import 'reflect-metadata';
import {Component} from 'angular2/core';
import {Parties} from '../../../collections/parties.ts';
import {PartiesForm} from '../parties-form/parties-form.ts';

@Component({
  selector: 'parties-list',
  templateUrl: '/client/imports/parties-list/parties-list.html',
  directives: [PartiesForm]
})

export class PartiesList {
  parties: Mongo.Cursor;

  constructor() {
    this.parties = Parties.find();
  }

  removeParty(party) {
    Parties.remove(party._id);
  }
}

是否可以在应用程序外部的另一个html文件中使用此组件,例如:

<body>
...
<parties-list></parties-list>
</body>

提前致谢。

您可以在Angular应用程序中使用它,例如

bootstrap(PartiesList)

或从另一个Angular组件的角度来看。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM