博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
PrimeNG01 angular集成PrimeNG
阅读量:5157 次
发布时间:2019-06-13

本文共 3213 字,大约阅读时间需要 10 分钟。

 

1 开发环境

  本博文基于angular5

  

 

2 步骤

  2.1 创建angular5项目

    详情参见百度

  2.2 下载PrimeNG依赖

npm install primeng --savenpm install primeicons --save

  2.3 在Angular项目中引入PrimeNG样式

    修改 angular-cli.json配置文件

      

{  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",  "project": {    "name": "hello-angular"  },  "apps": [    {      "root": "src",      "outDir": "dist",      "assets": [        "assets",        "favicon.ico"      ],      "index": "index.html",      "main": "main.ts",      "polyfills": "polyfills.ts",      "test": "test.ts",      "tsconfig": "tsconfig.app.json",      "testTsconfig": "tsconfig.spec.json",      "prefix": "",      "styles": [        "styles.scss",        "../node_modules/primeicons/primeicons.css",        "../node_modules/primeng/resources/themes/omega/theme.css",        "../node_modules/primeng/resources/primeng.min.css"      ],      "scripts": [],      "environmentSource": "environments/environment.ts",      "environments": {        "dev": "environments/environment.ts",        "prod": "environments/environment.prod.ts"      }    }  ],  "e2e": {    "protractor": {      "config": "./protractor.conf.js"    }  },  "lint": [    {      "project": "src/tsconfig.app.json",      "exclude": "**/node_modules/**"    },    {      "project": "src/tsconfig.spec.json",      "exclude": "**/node_modules/**"    },    {      "project": "e2e/tsconfig.e2e.json",      "exclude": "**/node_modules/**"    }  ],  "test": {    "karma": {      "config": "./karma.conf.js"    }  },  "defaults": {    "styleExt": "scss",    "component": {}  }}
View Code

  2.4 引入动效依赖

npm install @angular/animations --save

    引入依赖后,在跟模块引入相关模块

import {BrowserModule} from '@angular/platform-browser';import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
{  "name": "hello-angular",  "version": "0.0.0",  "license": "MIT",  "scripts": {    "ng": "ng",    "start": "ng serve",    "build": "ng build --prod",    "test": "ng test",    "lint": "ng lint",    "e2e": "ng e2e"  },  "private": true,  "dependencies": {    "@angular/animations": "^5.2.11",    "@angular/common": "^5.2.0",    "@angular/compiler": "^5.2.0",    "@angular/core": "^5.2.0",    "@angular/forms": "^5.2.0",    "@angular/http": "^5.2.0",    "@angular/platform-browser": "^5.2.0",    "@angular/platform-browser-dynamic": "^5.2.0",    "@angular/router": "^5.2.0",    "bootstrap": "^3.3.7",    "core-js": "^2.4.1",    "primeicons": "^1.0.0-beta.9",    "primeng": "^6.0.0",    "rxjs": "^5.5.6",    "zone.js": "^0.8.19"  },  "devDependencies": {    "@angular/cli": "~1.7.0",    "@angular/compiler-cli": "^5.2.0",    "@angular/language-service": "^5.2.0",    "@types/jasmine": "~2.8.3",    "@types/jasminewd2": "~2.0.2",    "@types/node": "~6.0.60",    "codelyzer": "^4.0.1",    "jasmine-core": "~2.8.0",    "jasmine-spec-reporter": "~4.2.1",    "karma": "~2.0.0",    "karma-chrome-launcher": "~2.2.0",    "karma-coverage-istanbul-reporter": "^1.2.1",    "karma-jasmine": "~1.1.0",    "karma-jasmine-html-reporter": "^0.2.2",    "protractor": "~5.1.2",    "ts-node": "~4.1.0",    "tslint": "~5.9.1",    "typescript": "~2.5.3"  }}
View Code

  2.5 文档

 

3 PrimeNG

  

    

 

  

转载于:https://www.cnblogs.com/NeverCtrl-C/p/9254612.html

你可能感兴趣的文章
写接口请求类型为get或post的时,参数定义的几种方式,如何用注解(原创)--雷锋...
查看>>
【OpenJ_Bailian - 2287】Tian Ji -- The Horse Racing (贪心)
查看>>
Java网络编程--socket服务器端与客户端讲解
查看>>
List_统计输入数值的各种值
查看>>
学习笔记-KMP算法
查看>>
Timer-triggered memory-to-memory DMA transfer demonstrator
查看>>
跨域问题整理
查看>>
[Linux]文件浏览
查看>>
64位主机64位oracle下装32位客户端ODAC(NFPACS版)
查看>>
获取国内随机IP的函数
查看>>
今天第一次写博客
查看>>
江城子·己亥年戊辰月丁丑日话凄凉
查看>>
IP V4 和 IP V6 初识
查看>>
Spring Mvc模式下Jquery Ajax 与后台交互操作
查看>>
(转)matlab练习程序(HOG方向梯度直方图)
查看>>
『Raid 平面最近点对』
查看>>
【ADO.NET基础-数据加密】第一篇(加密解密篇)
查看>>
C语言基础小结(一)
查看>>
STL中的优先级队列priority_queue
查看>>
UE4 使用UGM制作血条
查看>>