關(guān)于angular引入ng-zorro的問題淺析
ng-zorro的官網(wǎng)上提供了兩種在項目中添加ng-zorro的方法,下面記錄其提供的第二種自行構(gòu)建的方式。
第一步:執(zhí)行該命令創(chuàng)建新的angular項目,若沒安裝angular/cli請執(zhí)行安裝
ng new new-project
第二步:添加ng-zorro
npm install ng-zorro-antd --save
第三步:引入模塊
在app.module.ts文件中引入
import { NgZorroAntdModule } from 'ng-zorro-antd';
...... imports: [ BrowserModule, FormsModule, HttpClientModule, BrowserAnimationsModule, /** 導(dǎo)入 ng-zorro-antd 模塊 **/ NgZorroAntdModule ] ......
第四步:在 angular.json 文件中引入樣式
{
"assets": [
...
],
"styles": [
...
"node_modules/ng-zorro-antd/ng-zorro-antd.min.css"
] }
第五步:在入口style.css或者style.less文件下引入組件樣式
@import "~ng-zorro-antd/style/index.min.css"; /* 引入基本樣式 */ @import "~ng-zorro-antd/button/style/index.min.css"; /* 引入組件樣式 */
或
@import "~ng-zorro-antd/style/entry.less"; /* 引入基本樣式 */ @import "~ng-zorro-antd/button/style/entry.less"; /* 引入組件樣式 */
然后在所需要的組件中使用ng-zorro就可正常使用了。
總結(jié)
到此這篇關(guān)于關(guān)于angular引入ng-zorro的問題的文章就介紹到這了,更多相關(guān)angular引入ng-zorr問題內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
AngularJS+Node.js實現(xiàn)在線聊天室
隨著互聯(lián)網(wǎng)和信息技術(shù)的發(fā)展,如何快速構(gòu)建高效、強大的動態(tài)網(wǎng)站成為很多人研究的熱點。該文將結(jié)合AngularJS和Node.js構(gòu)建一個在線聊天室,體現(xiàn)AngularJs和Node.js整合的優(yōu)點。2015-08-08
Bootstrap與Angularjs的模態(tài)框?qū)嵗a
這篇文章主要介紹了Bootstrap與Angularjs的模態(tài)框?qū)嵗a,需要的朋友可以參考下2017-08-08
Angularjs通過指令監(jiān)聽ng-repeat渲染完成后執(zhí)行腳本的方法
指令是angular的核心功能之一,用好了事半功倍,監(jiān)聽ng-repeat執(zhí)行狀態(tài)僅僅是它功能的冰山一角吧。下面這篇文章主要介紹了Angularjs通過指令監(jiān)聽ng-repeat渲染完成后執(zhí)行腳本的方法,需要的朋友可以參考下。2016-12-12
AngularJS 路由和模板實例及路由地址簡化方法(必看)
下面小編就為大家?guī)硪黄狝ngularJS 路由和模板實例及路由地址簡化方法(必看)。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2016-06-06

