在我为Angular 2找到的示例中,每个应用程序可以创建一次组件:
(function(app) { app.AppComponent = ng.core.Component({ selector: 'my-app',template: '<h1>My First Angular 2 App</h1>' }) .Class({ constructor: function() {} }); })(window.app || (window.app = {}));
使用app / main.js引导组件:
(function(app) { document.addEventListener('DOMContentLoaded',function() { ng.platform.browser.bootstrap(app.AppComponent); }); })(window.app || (window.app = {}));
但是,我如何定义可重用的组件?文档似乎写在Typescript或Angular 1中.