在Angular 6
(6.0.7)中我试图通过CLI生成组件.我输入ng g c t1-2-3-user
并获取错误消息Selector (app-t1-2-3-user) is invalid.
这个名字本身不允许有什么东西吗?我已经创建了一个名为t1-myModule
via 的父模块ng g module t1-myModule
,它已成功创建.在该模块中,我正在尝试生成此组件.
我尝试创建一个不同的名称ng g c t1-testComponent
,它工作正常 - 所以CLI似乎没有被打破.t1-2-3-user
Angular不喜欢在我的设置中命名组件的东西.
编辑: 进一步测试后,看起来Angular不喜欢破折号后的第一个字符-
.可能与JavaScript变量类似.我假设它被编译成JavaScript?谁能详细说明/确认这个组件命名约束?
较新的 Mac(Catalina
在我的例子中为操作系统)现在有默认的Z Shell
aka zsh
。使用 Maczsh
终端窗口,我已成功进行Angular 11.0.5
全局安装并创建了一个项目。我正在使用nvm 0.32.2
和node 10.23.0
。
Visual Studio Code
但是,在 VS Code 中打开并导航到我的项目时integrated terminal
,我使用任何 ng 命令都会收到此错误消息,例如尝试生成组件:
zsh: command not found: ng
有谁知道如何正确设置 Visual Studio Codeintegrated terminal
以正确识别 ng 命令zsh
?
我在这里找到了一种可能的解决方法/sf/answers/4100887661/,但它使用了第三方工具,我希望尽可能避免使用第三方工具。没有其他已知的方法来解决这个问题吗?
Karma
我注意到我的构建的默认行为是按随机顺序Angular
运行单元测试。Jasmine
与每次都以相同的顺序运行测试相比,以随机顺序运行测试有什么好处?
Cypress 10 几天前发布,带来了大量重大突破性变化。作为第一次 Cypress 用户(从 Protractor 和 Cucumber 迁移),我没有意识到这一点。我正在尝试使用 Cucumber 安装 Cypress,但所有文档(也许还有cypress-cucumber-preprocessor
插件本身)都是为 Cypress 9 编写/配置的。
有没有人cypress-cucumber-preprocessor
在 Angular 项目中成功配置或迁移 Cypress 10,如果是,步骤是什么?
cucumber typescript angular cypress cypress-cucumber-preprocessor
我正在为一个项目进行调查micro frontend
和架构。最近, Webpack 的微前端解决方案已准备好投入生产。通过模块联合,我们有了 shell 应用程序 或 的概念,它容纳您的微前端应用程序 或。monorepo
Angular 12
Webpack 5
Module Federation
host
remotes
我也在研究monorepos
,特别是nx
.
Module Federation
与 monorepo 结合是nx
一件事吗?或者,是否不需要像nx
whenModule Federation
已经为我提供了一个shell
包含我所有微前端应用程序的东西?据我了解,Module Federation
它听起来几乎就像一个 monorepo 本身。
换句话说,Webpack 5 Module Federation
和是nx monorepos
相互排斥的还是可以/应该一起使用?
architecture webpack monorepo angular webpack-module-federation
我正在alt
为我的所有图像添加属性,以提高SEO /屏幕阅读器的性能.
根据最佳实践,纯粹美学的图像应具有空的alt属性,alt=""
以便屏幕阅读器跳过它们.我在WordPress中并注意到它确实增加alt
了这些无描述的美学图像,但没有alt=""
.
是否alt
与alt=""
屏幕阅读器和搜索引擎爬虫相同,或者我应该进入并以编程方式强制执行alt=""
?
在中polyfills.ts
,注释掉的行之一如下:
/** IE10 and IE11 requires the following for the Reflect API. */
// import 'core-js/es6/reflect';
Run Code Online (Sandbox Code Playgroud)
什么是“反映API”?它需要什么IE用例?在其中运行Angular
应用程序时,此import语句通常很重要IE
吗?令人惊讶的是,Google和StackOverflow并没有为我带来很多/任何结果。
internet-explorer cross-browser polyfills typescript angular
我用可观察的东西撞在墙上。我可以找到的几乎所有文档都使用较旧的rxjs
语法。
我有一个可观察到的API调用。我在其他地方调用它并进行预订-尝试用此GET
请求中的数据填充表。
如果仅是console.log
我的getData
函数,它将记录订阅而不是数据。我可以data
在.subscribe
函数内成功console.log ,但是我想在data
之外使用.subscribe()
。
我如何提取data
出来的.subscribe()
功能和其他地方使用它?还是必须将我所有的逻辑都包含在.subscribe()
要使用的函数中data
?
getData2() {
return this.m_dbService.get('api/myApiPath').subscribe(
data => (console.log(data)), //This properly logs my data. How to extract `data` out of here and actually use it?
error => { throw error },
() => console.log("finished")
);
}
workbookInit(args){
var datasource = this.getData2(); // this returns the subscription and doesn't work.
}
Run Code Online (Sandbox Code Playgroud) 我已经将一个 Git 仓库从原始源的upstream
master
仓库克隆到了我的本地机器上。
git remote -v
返回:
origin https://github.com/project.git (fetch)
origin https://github.com/project.git (push)
Run Code Online (Sandbox Code Playgroud)
但我现在知道我需要将这个upstream
master
分支分叉到我的个人 GitHub 帐户,克隆它,创建一个新分支,然后开始编码(这样我就不会直接对upstream
repo进行更改,而是对我自己的分叉origin
repo进行更改)。我已将 分叉upstream
master
到我的 GitHub 个人资料,但不知道如何继续。我需要git remote -v
看起来像这样:
origin https://github.com/myGitHubProfile/project.git (fetch)
origin https://github.com/myGitHubProfile/project.git (push)
upstream https://github.com/project.git (fetch)
upstream https://github.com/project.git (push)
Run Code Online (Sandbox Code Playgroud)
鉴于我已经upstream
master
从原始来源克隆了并且它已经设置为,我该如何实现origin
?
我正在编辑Sublime Text 3中保存的.php文件(构建3126 for mac),当我尝试使用cmd+ 注释某些内容时/,Sublime会插入标准HTML注释
<!-- -->
Run Code Online (Sandbox Code Playgroud)
当我尝试使用DocBlocks,/**/,#或//时,Sublime不会注释掉.
我已经检查过,Sublime目前已经设置为PHP语法,应该是这样.Build System设置为Automatic.有没有人经历过这个,你知道修复吗?我在StackExchange的任何地方都找不到这个问题,我在Google上找到的唯一一件事就是:
https://forum.sublimetext.com/t/cant-set-syntax-to-php/7478/8
由于他们的症状与我的症状并不完全相符,我想我会先问到这里,直到清除我不太了解的缓存.
angular ×6
typescript ×4
alt ×1
angular-cli ×1
angular6 ×1
architecture ×1
asynchronous ×1
attributes ×1
cucumber ×1
cypress ×1
cypress-cucumber-preprocessor ×1
git ×1
github ×1
html ×1
javascript ×1
macos ×1
monorepo ×1
observable ×1
php ×1
polyfills ×1
repository ×1
rxjs ×1
seo ×1
sublimetext3 ×1
subscribe ×1
terminal ×1
unit-testing ×1
webpack ×1
zsh ×1