Angular学习笔记

NPM帮助

npm help

npm -l 列出所有命令用法

npm <cmd> -h 查看某一命令用法,如:

npm ls -h

npm help npm 在浏览器中查看帮助文档,如:

npm help index (Index of all npm documentation)

npm help folders

npm help install

 

ng帮助

ng help 显示所有命令的帮助

ng help -s 仅显示命令名称和描述

ng help <command-name> 显示某一命令的帮助

 

Updating Angular CLI
To update Angular CLI to a new version, you must update both the global package and your project's local package.

Global package:

npm uninstall -g @angular/cli
npm cache clean
# if npm version is > 5 then use `npm cache verify` to avoid errors (or to avoid using --force)
npm install -g @angular/cli@latest

 
Local project package:

# use rmdir /S/Q node_modules dist in Windows Command Prompt;
# use rm -r -fo node_modules,dist in Windows PowerShell
rm -rf node_modules dist
npm install --save-dev @angular/cli@latest
npm install

 

一次升级 package.json的所有版本

需使用npm-check-updates工具

# 安装npm-check-updates

npm i -g npm-check-updates

# 升级

ncu -u

# 安装新版本

npm install

 

运行npm ls可查看版本是否匹配。

运行npm view <package>可查看某一package发布的版本,如:

npm view ngx-bootstrap [versions]

进入package目录下,运行npm version可查看安装的版本。

 

package.json中的version语法请参见The semantic versioner for npm

 

搭建NPM私服

推荐使用Nexus,概念和配置方法同Maven私服一致,分为proxy、hosted、group三类。

创建proxy如下:



 Remote URL: https://registry.npmjs.org

然后创建hosted、group,不再赘述。

最后在home下创建.npmrc文件,其内填写public地址,如下:

registry=http://localhost:8081/repository/npm-public/

 

Cannot find module 'node-sass'

npm install node-sass --no-bin-links

 

Angular - CKEditor component

1. Include CKEditor javascript files in your application

<script src="https://cdn.ckeditor.com/4.7.3/full-all/ckeditor.js"></script>

2. Install ng2-ckeditor
npm install --save ng2-ckeditor

3.Include CKEditorModule in your main module

import { CKEditorModule } from 'ng2-ckeditor';

@NgModule({
  // ...
  imports:      [
    CKEditorModule
  ],
  // ...
})
export class AppModule { }

4. usage
<ckeditor [(ngModel)]="content" [config]="{extraPlugins: 'divarea'}" name="editor"></ckeditor>

 

Angular

Angular中文

Angular中文社区

Angular 4.x 修仙之路

TypeScript

TypeScript中文网

Angular CLI

NPM Docs

RxJS

Angular HTTP Client - Quickstart Guide

Angular Architecture - Smart Components vs Presentational Components

Multiple solutions for Angular Ahead of Time (AOT) Compilation

Angular - CKEditor component

猜你喜欢

转载自billben.iteye.com/blog/2397768