3. Micro-frontends with Angular 10
使用 Angular 10 實現微前端
Implementing Micro-frontends with Angular 10
將元件整合進不同的前端框架
Integrate Angular 10 components into other frameworks
何謂微前端
What is Micro-frontends?
4. Micro-frontends with Angular 10
使用 Angular 10 實現微前端
Implementing Micro-frontends with Angular 10
將元件整合進不同的前端框架Integrate Angular 10 components into other frameworks
何謂微前端
What is Micro-frontends?
5. 微前端 (Micro Frontends)
• 最早出現於 2016 年 ThoughtWorks 的技術雷達
• 借用 微服務架構 (Microservices) 許多概念與作法
• 有效解構大型前端架構下的各種相依、協作、整合等問題
• Be Technology Agnostic(不限定各團隊所採用的前端技術)
• Isolate Team Code(不同的團隊代碼必須彼此隔離以降低相依性)
• Establish Team Prefixes(建立團隊之間的命名規則以降低資源衝突)
• Favor Native Browser Features over Custom APIs(使用原生 API 為
主)
• Build a Resilient Site(建置有高度彈性、遇到錯誤可迅速回復的站台)
8. Micro-frontends with Angular 10
使用 Angular 10 實現微前端
Implementing Micro-frontends with Angular 10
將元件整合進不同的前端框架Integrate Angular 10 components into other frameworks
何謂微前端
What is Micro-frontends?
9. 初始化專案
• ng new --create-application=false mfdemo1 && cd mfdemo1
• ng g application mfdemo1 --routing --style=css
• ng g application mf-element1 --routing=false --style=css
• ng add @angular/elements --project=mf-element1
• ng add ngx-build-plus --project=mf-element1
10. 移除 AppComponent 的 selector 屬性
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'mf-element1';
}
16. Micro-frontends with Angular 10
使用 Angular 10 實現微前端
Implementing Micro-frontends with Angular 10
將元件整合進不同的前端框架Integrate Angular 10 components into other frameworks
何謂微前端
What is Micro-frontends?