首页  >  文章  >  web前端  >  Angular学习笔记之集成三方UI框架、控件的示例

Angular学习笔记之集成三方UI框架、控件的示例

亚连
亚连原创
2018-05-29 11:58:421668浏览

这篇文章主要介绍了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 列表

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

上面是我整理给大家的,希望今后会对大家有帮助。

相关文章:

Vue 自定义动态组件实例详解

详解VUE 对element-ui中的ElTableColumn扩展

微信小程序之分享页面如何返回首页的示例

以上是Angular学习笔记之集成三方UI框架、控件的示例的详细内容。更多信息请关注PHP中文网其他相关文章!

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn