首頁  >  文章  >  web前端  >  Angular學習筆記之整合三方UI框架、控制的範例

Angular學習筆記之整合三方UI框架、控制的範例

亚连
亚连原創
2018-05-29 11:58:421669瀏覽

這篇文章主要介紹了Angular學習筆記之集成三方UI框架、控件的示例,詳細的介紹了Material UI、Ag-grid等框架,具有一定的參考價值,感興趣的小伙伴們可以參考一下

本文介紹了Angular學習筆記之集成三方UI框架、控制項的範例,分享給大家,具體如下:

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 href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="external nofollow" rel="stylesheet">

step 5:

  app.module.ts
  import {MatInputModule, MatCardModule, MatButtonModule} from "@angular/material";
  import {BrowserAnimationsModule} from &#39;@angular/platform-browser/animations&#39;;
  imports:[
    BrowserAnimationsModule,
    MatInputModule,
    MatCardModule,
    MatButtonModule,
  ]

安裝Ag-grid 的方法

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 的方法

step 1:

npm install ng-zorro-antd --save

step 2:

#直接用下面的程式碼取代/src/app/app.module.ts 的內容

#注意:在根module 中需要使用NgZorroAntdModule.forRoot(),在子module 需要使用NgZorroAntdModule

import { BrowserModule } from &#39;@angular/platform-browser&#39;;
import { BrowserAnimationsModule } from &#39;@angular/platform-browser/animations&#39;;
import { NgModule } from &#39;@angular/core&#39;;
import { FormsModule } from &#39;@angular/forms&#39;;
import { HttpClientModule } from &#39;@angular/common/http&#39;;
import { NgZorroAntdModule } from &#39;ng-zorro-antd&#39;;
import { AppComponent } from &#39;./app.component&#39;;
@NgModule({
 declarations: [
  AppComponent
 ],
 imports: [
  BrowserModule,
  FormsModule,
  HttpClientModule,
  BrowserAnimationsModule,
  NgZorroAntdModule.forRoot()
 ],
 bootstrap: [AppComponent]
})
export class AppModule { }

step 3:

修改.angular-cli.json 檔案的styles 清單##rr

"styles": [
  "../node_modules/ng-zorro-antd/src/ng-zorro-antd.less"
]

上面是我整理給大家的,希望未來會對大家有幫助。

相關文章:

Vue 自訂動態元件實例詳解

詳解VUE 對element-ui中的ElTableColumn擴充

微信小程式之分享頁面如何回傳首頁的範例

以上是Angular學習筆記之整合三方UI框架、控制的範例的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn