typescript 将 Angular2 PrimeNG 版本 1.1.4 更新到最新版本

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/43258960/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 04:25:50  来源:igfitidea点击:

Update Angular2 PrimeNG version 1.1.4 to last version

angulartypescriptversionprimeng

提问by Pedro Marques

I'm relatively new to angular2, so I was wondering how could I update my version(1.1.4) to last version!

我对 angular2 比较陌生,所以我想知道如何将我的版本(1.1.4)更新到最新版本!

I'm working on version 2.0.0-rc.5 of angular2.

我正在研究 angular2 的 2.0.0-rc.5 版本。

Already tried

已经试过了

npm install primeng --save

but package.json still holds this value: ""primeng": "^1.1.4","

但 package.json 仍然持有这个值: ""primeng": "^1.1.4","

the package.json from the root directory of angular, and also of the primeng in node_modules directory

angular 根目录下的 package.json,以及 node_modules 目录下的primeng

回答by Pedro Marques

For future references: Had to uninstall with:

供将来参考:必须卸载:

npm uninstall primeng --save

Run the code below to avoid unnecessary errors:

运行下面的代码以避免不必要的错误:

npm cache verify

And then install with the version you want

然后用你想要的版本安装

npm install [email protected] --save

thanks for you answer though

谢谢你的回答

回答by alanHdez

You only need run npm update --saveinto the folder that contains your package.json

您只需要运行npm update --save到包含您的文件夹package.json

Before:

前:

"dependencies": {
   ....
    "primeng": "^1.1.4",
   ....
 },

After:

后:

"dependencies": {
    ....
   "primeng": "^2.0.5",
    ....
 },

Note: this command update whole your dependencies...

注意:此命令更新整个依赖项...

回答by Ambuj Khanna

Use "import {SidebarModule} from 'primeng/components/sidebar/sidebar';"

使用“ import {SidebarModule} from 'primeng/components/sidebar/sidebar';

instead "import { SidebarModule } from 'primeng/primeng';"

而是“ import { SidebarModule } from 'primeng/primeng';