首页/新闻资讯/正文详情

Angular新建应用_angular-new-app

发布时间:2026/11/27 21:49:23 来源:云帆数科 栏目:资讯中心
Angular新建应用_angular-new-app
以下为本文档的中文说明该技能用于使用Angular CLI创建新的Angular应用涵盖了从项目初始化到最佳实践的全流程。其功能是引导开发者在创建新Angular应用时遵循现代Angular开发的最佳实践包括正确的项目结构、模块化设计、组件化开发思想以及性能优化策略。使用场景非常明确当用户需要创建一个新的Angular单页应用时技能首先检查Angular CLI是否已安装通过which ng或where ng命令如果未安装则引导用户全局安装angular/cli包。技能的核心步骤包括选择合适的Angular版本、使用正确的CLI命令初始化项目、选择合适的样式预处理器SCSS、LESS等、配置路由策略如惰性加载模块、设置合适的项目结构功能模块划分、共享模块设计。技能还强调了几个关键原则使用Standalone Components作为默认组件模式Angular 14的新特性利用Angular CLI的自动生成功能来创建组件、服务、管道和指令遵循Angular风格指南中的命名约定和文件组织方式。此外技能还涵盖了性能优化的最佳实践如使用ChangeDetectionStrategy.OnPush、正确使用async管道、合理使用trackBy函数优化列表渲染等。总之该技能是将Angular官方最佳实践系统化、可操作化的开发助手。Angular New AppYou are an expert in TypeScript, Angular, and scalable web application development. You write functional, maintainable, performant, and accessible code following Angular and TypeScript best practices. You have access to tools to create new Angular apps.When creating a new Angular application for a user, always follow the following steps:Check for the Angular CLI: Confirm that the Angular CLI is present before continuing. Here are some ways to confirm:on*nixsystemswhich ngon Windows systemswhere ng, if powershellgcm ngIf it is present, skip to step 2, if not, ask the user if they’d like to install it globally for the user with the following command:npm install -g angular/cliIMPORTANT: There are best practices available for building outstanding Angular applications via the MCP server that is bundled with the Angular CLI. Available throughng mcpand theget_best_practices.Create the new application: To create the application either suggest a name based on the user prompt or ask the user the name of the application. Create the application with the following command:npx ng new app-name [list of flags based on the description of the app] --interactivefalse --ai-config[agents, claude, copilot, cursor, gemini, jetbrains, none, windsurf]Important: Prefer agent for--ai-config, or use the option that best suits the environment, for example if the user is using Gemini, use--ai-configgemini.Load the contents of that AI configuration into memory so that you can refer to it when generating code for the user. This will help you generate code that is consistent with modern Angular best practices.Consider these commonly useful flags based on the user’s requirements:--stylescss|css|less— stylesheet format--routing— add routing module--ssr— enable server-side rendering--prefixprefix— component selector prefix--skip-tests— only if the user explicitly requests itDo not start the app until you’ve built some features, ask the user if they want to start the app. You can always runnpx ng buildto check for errors and repair them.Remember the following guidelines for continuing to generate Angular application code:To generate components, use the Angular CLInpx ng generate component component-nameTo generate services, use the Angular CLInpx ng generate service service-nameTo generate pipes, use the Angular CLInpx ng generate pipe pipe-nameTo generate directives, use the Angular CLInpx ng generate directive directive-nameTo generate interfaces, use the Angular CLInpx ng generate interface interface-nameTo generate guards, use the Angular CLInpx ng generate guard guard-nameTo generate interceptors, use the Angular CLInpx ng generate interceptor interceptor-nameTo generate resolvers, use the Angular CLInpx ng generate resolver resolver-nameTo generate enums, use the Angular CLInpx ng generate enum enum-nameTo generate classes, use the Angular CLInpx ng generate class class-nameIMPORTANT: Take note of the path returned from running the generate commands so that you know exactly where the new files are.Use the Angular CLI to generate the code, then augment the code to meet the needs of the application.To add tailwind, runnpx ng add tailwindcss. After that, you do not have to do anything else, you can start using tailwind classes in your Angular application. Follow the best practices for tailwind v4 here, learn more if needed: https://tailwindcss.com/docs/upgrade-guide.IMPORTANT: There are best practices available for building outstanding Angular applications via the MCP server that is bundled with the Angular CLI. Available throughnpx ng mcpand theget_best_practices.3f:[“,,,L42”,null,{“content”:“$43”,“frontMatter”:{“name”:“angular-new-app”,“description”:“Creates a new Angular app using the Angular CLI. This skill should be used whenever a user wants to create a new Angular application and contains important guidelines for how to effectively create a modern Angular application.”,“license”:“MIT”,“compatibility”:“Requires node, npm, and access to the internet”,“metadata”:{“author”:“Angular Team Google”,“version”:“1.0”}}}]

相关推荐

【限时公开】影视级AI视频换背景工作流:GPU显存低于8GB也能跑通的轻量化Pipeline(附私藏Prompt库)
【限时公开】影视级AI视频换背景工作流:GPU显存低于8GB也能跑通的轻量化Pipeline(附私藏Prompt库)

更多请点击: https://codechina.net 第一章:影视级AI视频换背景工作流全景概览 影视级AI视频换背景并非简单叠加抠图,而是融合语义分割、深度估计、光照一致性建模与时间域连贯性优化的端到端生产流程。该工作流要求在保持人物边缘自然、阴… · 2026/11/27 21:45:28

StreamFX完整指南:5个痛点场景,让你的OBS直播瞬间升级专业级
StreamFX完整指南:5个痛点场景,让你的OBS直播瞬间升级专业级

StreamFX完整指南:5个痛点场景,让你的OBS直播瞬间升级专业级 【免费下载链接】obs-StreamFX StreamFX is a plugin for OBS Studio which adds many new effects, filters, sources, transitions and encoders! Be it 3D Transform, Blur, complex Maski… · 2026/8/6 19:38:29

Azure日志下载_azp-logs
Azure日志下载_azp-logs

以下为本文档的中文说明该技能用于下载Azure Pipelines(Azure Pipelines)的CI日志进行分析。Azure Pipelines是微软提供的持续集成/持续部署服务,此技能支持自动获取构建管线的执行日志,便于离线分析或集成到自定义诊断工具中。适… · 2026/7/27 22:56:21

工地太忙根本没时间复习考试?甘孜州高压电工证千万别踩坑
工地太忙根本没时间复习考试?甘孜州高压电工证千万别踩坑

工地太忙根本没时间复习考试?甘孜州高压电工证千万别踩坑 工地太忙根本没时间复习考试?别急,先说清楚一个事: 甘孜州高压电工证千万别踩坑… · 2026/11/28 7:34:58

观澜考试电工证在哪考全流程避坑指南
观澜考试电工证在哪考全流程避坑指南

观澜考试电工证在哪考全流程避坑指南 之前考的证在外省能不能转过来?这几乎是所有打算考电工证的朋友最先问的问题。别急,这篇文章就是给你讲清楚【观澜考试电工证在哪考】的全流程,从报名到查询,从考试到复审,帮你一步步理清楚思路。… · 2026/11/28 7:34:58

临汾的电工证培训机构在哪考?证书过期了别慌,这里有全流程指南
临汾的电工证培训机构在哪考?证书过期了别慌,这里有全流程指南

临汾的电工证培训机构在哪考?证书过期了别慌,这里有全流程指南 证书过期了不知道怎么复审延期?这事儿临汾不少电工朋友都遇到过,尤其是那些在建筑工地、工厂、配电房长期从事电气工作的电工,稍不留神就可能错过复审时间。别急, 临汾的电工证培训机构… · 2026/11/28 7:34:58

电力施工电工作业证全国通用吗 官方回应来了
电力施工电工作业证全国通用吗 官方回应来了

电力施工电工作业证全国通用吗 官方回应来了 你还在为找不到工作发愁?特种作业证成了不少人的“入场券”,尤其是 电力施工电工作业证… · 2026/11/28 7:34:58

之前考的证在外省能不能转过来?真实经历告诉你考电工证作用大吗现在
之前考的证在外省能不能转过来?真实经历告诉你考电工证作用大吗现在

之前考的证在外省能不能转过来?真实经历告诉你考电工证作用大吗现在 之前考的证在外省能不能转过来?这个问题我听得太多了,特别是像你这样在驻马店做建筑工的朋友,换城市打工、换工地,最怕的就是证书不能用,白花钱不说,还耽误工作。今天我就用自己和身… · 2026/11/28 7:33:57

高级电工证操作内容通过率揭秘:证书过期了不知道怎么复审延期怎么办
高级电工证操作内容通过率揭秘:证书过期了不知道怎么复审延期怎么办

高级电工证操作内容通过率揭秘:证书过期了不知道怎么复审延期怎么办 你是不是也遇到过这种情况: 证书过期了,不知道怎么复审延期 ?别急,这篇文章就带你从【高级电工证操作内容】的考试真题、备考技巧,到复审流程,全都讲明白。尤其是 通过率揭秘… · 2026/11/28 7:33:57

平价的电工证查询保姆级教程:别被中介坑,一步步教你搞定
平价的电工证查询保姆级教程:别被中介坑,一步步教你搞定

平价的电工证查询保姆级教程:别被中介坑,一步步教你搞定 你是不是也经常在网上看到“平价的电工证查询”这样的关键词,但又不知道去哪报名,怕被中介坑?特别是像你这样的平顶山学员,既想考个正规电工证,又怕花冤枉钱走弯路。别担心,这篇保姆级教程就是… · 2026/11/28 1:08:19

麻阳考电工证在哪里考内部消息你知道吗
麻阳考电工证在哪里考内部消息你知道吗

麻阳考电工证在哪里考内部消息你知道吗 不知道去哪报名怕被中介坑, 内部消息 告诉你,麻阳考电工证不一定要去外地,本地其实也有正规渠道,但很多人因为不了解流程和资质,反而被坑了钱还考不到证。今天我就从一个干了这么多年特种作业培训的“老江湖”角… · 2026/11/27 3:38:27

揭阳普宁电工证换证怎么操作?良心建议帮你理清流程
揭阳普宁电工证换证怎么操作?良心建议帮你理清流程

揭阳普宁电工证换证怎么操作?良心建议帮你理清流程 之前考的证在外省能不能转过来?这是很多已经在外地工作、现在想回揭阳普宁发展的电工朋友最关心的问题。如果你也是其中之一,那这篇文章就是为你们量身定制的,从换证流程到避坑建议,良心建议全给你讲透… · 2026/11/27 17:56:55

电工证在西安哪里办?外省证能转过来吗?上岗必备全流程详解
电工证在西安哪里办?外省证能转过来吗?上岗必备全流程详解

电工证在西安哪里办?外省证能转过来吗?上岗必备全流程详解 之前考的证在外省能不能转过来?这是很多从外地来西安工作的电工最关心的问题。特别是那些在郑州、洛阳、开封等地从事房建工程的电工,随着项目转移到西安,证件问题成了摆在眼前的“上岗必备”难… · 2026/11/28 0:00:19

广东考电工证别再踩坑了!良心建议帮你搞懂报考流程和职业前景
广东考电工证别再踩坑了!良心建议帮你搞懂报考流程和职业前景

广东考电工证别再踩坑了!良心建议帮你搞懂报考流程和职业前景 电工证不光是上岗的通行证,更是你进入工地、工厂、维修行业的“敲门砖”。很多小伙伴都遇到过这种情况:刚拿到证就过期了,换证流程搞不清楚,耽误了工作机会。别急,这篇文章就是给你一个… · 2026/11/28 0:00:19

工地太忙根本没时间复习考试?三方电工证合作机构值不值得考
工地太忙根本没时间复习考试?三方电工证合作机构值不值得考

工地太忙根本没时间复习考试?三方电工证合作机构值不值得考 你是不是也这样,整天在工地上跑来跑去,连吃饭的时间都紧张,更别提抽空复习考试了?尤其是像 三方电工证合作机构 这类证书,听起来门槛不低,但你可能还在纠结—— 值不值得考… · 2026/11/28 0:00:19

双极步进电机控制实战:DRV8818PWPR与PIC18F86K22驱动调试
双极步进电机控制实战:DRV8818PWPR与PIC18F86K22驱动调试

/* MD / 富文本中的 .toc(含博客园搬家等嵌套结构);.toc-box 在侧栏,不受影响 */#content_views .toc,/* 编辑器常在目录前后插入空 p(:empty 仍占 20px),一并去掉避免顶空隙 */#content_views.markdown_views > p:empty:has(+ .toc),#content_views.markdown_views … · 2026/11/28 0:39:37

STM32F207ZG + DRV8818PWPR 步进电机驱动实战解析
STM32F207ZG + DRV8818PWPR 步进电机驱动实战解析

/* MD / 富文本中的 .toc(含博客园搬家等嵌套结构);.toc-box 在侧栏,不受影响 */#content_views .toc,/* 编辑器常在目录前后插入空 p(:empty 仍占 20px),一并去掉避免顶空隙 */#content_views.markdown_views > p:empty:has(+ .toc),#content_views.markdown_views … · 2026/11/27 17:16:48

DRV8818PWPR+dsPIC30F4013工业级双极步进电机控制方案
DRV8818PWPR+dsPIC30F4013工业级双极步进电机控制方案

/* MD / 富文本中的 .toc(含博客园搬家等嵌套结构);.toc-box 在侧栏,不受影响 */#content_views .toc,/* 编辑器常在目录前后插入空 p(:empty 仍占 20px),一并去掉避免顶空隙 */#content_views.markdown_views > p:empty:has(+ .toc),#content_views.markdown_views … · 2026/11/27 17:26:35

了解更多?预约专属演示

我们的顾问将为您一对一讲解产品与方案

企业微信二维码