简体   繁体   English

如何使用独立组件启动 Angular 项目

[英]how to initiate angular project with standalone component

现在 Angular 已经发布了独立组件,我可以只使用独立组件启动 Angular 并一起删除NgModule吗?

yes you can using the new introduced bootstrapApplication which is imported from @angular/platform-browser in the main.ts file是的,您可以使用从main.ts文件中的@angular/platform-browser b​​rowser 导入的新引入的bootstrapApplication

here is the full code这是完整的代码

import { enableProdMode } from '@angular/core';
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app/app.component';
import { environment } from './environments/environment';
if (environment.production) {
  enableProdMode();
}
bootstrapApplication(AppComponent)
  .catch(err => console.error(err));

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

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