# ng9-demo **Repository Path**: JXHuang_admin/ng9-demo ## Basic Information - **Project Name**: ng9-demo - **Description**: angular9 例子 - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-06-30 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## 例子 其他目录是原来的例子可以不理,只是拉下来看下懒得删除。 由于本人太熟悉vue的status状态管理了,所有不单独列出组件传参的例子。自行百度 下面是例子对应的文件夹 - [x] 自定义模板 template-diy - [x] 动态组件 template-dynamic template-form - [x] 模板传值 template-variables template-form - [x] 元素操作 text-danger.directive - [x] 内容投影 content-part-layout content-part-a content-part-b - [x] 动态加载不同组件,选项卡 template-dynamic-service template-dynamic-service.servicer app.component - [x] 全局状态 status-global-a status-global-b template-dynamic-service.servicer app.component ## angular-cli常用指令 ``` 你可以使用ng generate命令,为已有的 Angular 应用程序添加新的功能。 ng generate class my-new-class: 新建 class ng generate component my-new-component: 新建组件 ng generate directive my-new-directive: 新建指令 ng generate enum my-new-enum: 新建枚举 ng generate module my-new-module: 新建模块 ng generate pipe my-new-pipe: 新建管道 ng generate service my-new-service: 新建服务 ng generate快捷键: ng g cl my-new-class: 新建 class ng g c my-new-component: 新建组件 ng g d my-new-directive: 新建指令 ng g e my-new-enum: 新建枚举 ng g m my-new-module: 新建模块 ng g p my-new-pipe: 新建管道 ng g s my-new-service: 新建服务 其他添加功能用法: 创建带路由的模块ng generate module 模块名 --routing 创建模块下的组件ng generate component 模块名/组件名 创建全局服务ng generate service hero --module=app 创建路由控制器ng generate module app -routing --flat --module=app --flat:不单独创建一个文件夹。只创建文件 --module=app :告诉 CLI 把它注册到 AppModule 的 imports 数组中。 运行程序:ng serve --port 4200 --open --host 0.0.0.0 --port:表示程序运行的端口号为4200 --open:打开到浏览器,访问程序 --host: 设置host ```