本文介紹了Angular學習筆記之集成三方UI框架、控件的示例,分享給大家,具體如下:
安裝 Material UI 方法:
Material 官網:https://material.angular.io
step 1:
npm install --save @angular/material @angular/cdk
step 2:
npm install --save @angular/animations
step 3:
angular.cli 
../node_modules/@angular/material/prebuilt-themes/indigo-pink.css
or
style.css
@import "~@angular/material/prebuilt-themes/indigo-pink.css";
step 4:
index.html
<link rel="external nofollow" rel="stylesheet">
step 5:
  app.module.ts  import {MatInputModule, MatCardModule, MatButtonModule} from "@angular/material";  import {BrowserAnimationsModule} from '@angular/platform-browser/animations';  imports:[    BrowserAnimationsModule,    MatInputModule,    MatCardModule,    MatButtonModule,  ]安裝 Ag-grid 的方法
Ag-grid 官網:https://www.ag-grid.com/
step 1: 
npm install --save ag-grid-angular ag-grid
step 2:
angular.cli
"../node_modules/ag-grid/dist/styles/ag-grid.css","../node_modules/ag-grid/dist/styles/ag-theme-fresh.css"
step 3:
app.module.ts
imports:[ AgGridModule.withComponents([])],exports:[ AgGridModule]
安裝 NG-ZORRO 的方法
NG-ZORRO 官網:https://ng.ant.design/version/0.7.x/docs/introduce/zh
step 1:
npm install ng-zorro-antd --save
step 2:
直接用下面的代碼替換 /src/app/app.module.ts 的內容
注意:在根 module 中需要使用 NgZorroAntdModule.forRoot(),在子 module 需要使用 NgZorroAntdModule
import { BrowserModule } from '@angular/platform-browser';import { BrowserAnimationsModule } from '@angular/platform-browser/animations';import { NgModule } from '@angular/core';import { FormsModule } from '@angular/forms';import { HttpClientModule } from '@angular/common/http';import { NgZorroAntdModule } from 'ng-zorro-antd';import { AppComponent } from './app.component';@NgModule({ declarations: [  AppComponent ], imports: [  BrowserModule,  FormsModule,  HttpClientModule,  BrowserAnimationsModule,  NgZorroAntdModule.forRoot() ], bootstrap: [AppComponent]})export class AppModule { }step 3:
修改 .angular-cli.json 文件的 styles 列表
"styles": [ "../node_modules/ng-zorro-antd/src/ng-zorro-antd.less"]
以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持武林網。
新聞熱點
疑難解答