标签: stackblitz

为什么我的项目会导致“此元素上匹配了多个组件”。错误?

我在StackBlitz中有以下项目:

https://stackblitz.com/github/nickhodges/PhillyCCTodoApp/tree/Step20

我收到此错误:

Template parse errors:
More than one component matched on this element.
Make sure that only one component's selector can match a given element.
Run Code Online (Sandbox Code Playgroud)

我已经用尽心尽力地搜寻了一下,但似乎找不到解决方法。

此错误是什么意思,我该如何解决?

我应该注意,该错误仅在StackBlitz中发生,而不在我的本地计算机上发生。

angular stackblitz

3
推荐指数
2
解决办法
2995
查看次数

为什么我的Angular应用程序在StackBlitz上运行时会出错?

我有一个Angular应用程序在我的机器上运行正常ng serve,但是当我在StackBlitz上运行时:

https://stackblitz.com/github/nickhodges/primedirective

我收到以下错误:

Error in /turbo_modules/@angular/compiler@7.0.4/bundles/compiler.umd.js (2617:21)
Can't resolve all parameters for ApplicationModule: (?).
Run Code Online (Sandbox Code Playgroud)

我已经更新了StackBlitz编辑器上的依赖项,它仍然不起作用,给出了稍微不同的错误.

Error in /turbo_modules/@angular/compiler@7.1.0/bundles/compiler.umd.js (2497:21)
Can't resolve all parameters for ApplicationModule: (?).
Run Code Online (Sandbox Code Playgroud)

任何人都知道为什么StackBlitz会出现这个错误?

angular stackblitz

2
推荐指数
1
解决办法
771
查看次数

在Stackblitz上使用HttpClient读取data.json吗?

我有一个很小的演示,它尝试app/data.json使用Angular HttpClient 进行读取。

const post$:Observable<Post> = <Observable<Post>> http.get('./data.json');
Run Code Online (Sandbox Code Playgroud)

但是HttpClient响应说:

解析期间失败...

有什么想法吗?

javascript typescript angular stackblitz

2
推荐指数
1
解决办法
600
查看次数

如何在stackblitz中设置带有角度的笑话

是否可以设置stackblitz项目来使用 jest 运行角度单元测试?

更新:

让它与 codeandbox 一起工作(它已经在 jest 上运行)但还不能让它与 stackblitz 一起运行,考虑到它们的工作方式不同。

提前致谢!

unit-testing jestjs angular stackblitz

2
推荐指数
1
解决办法
1016
查看次数

StackBlitz - Property entries does not exist on type 'ObjectConstructor'

I am trying to use this syntax in StackBlitz:

const someObject = {};
for (let [key, value] of Object.entries(someObject)) {
   // .... do whatever
}
Run Code Online (Sandbox Code Playgroud)

The editor is underlining the entries in red and stating that "Property entries does not exist on type 'ObjectConstructor'".

However the code is still working. It seems to just be a linting issue where the editor thinks this won't work... but it does.

here is the stackblitz if someone could help https://stackblitz.com/edit/angular-validation-errors

How can I …

ecmascript-6 stackblitz

2
推荐指数
1
解决办法
505
查看次数

如何向 StackBlitz Angular 项目添加组件?

我在 StackBlitz 上创建了基本的 Angular 项目,并想添加我的组件。我右键单击 src 文件夹,Angular Generator > Component > test,它创建了带有测试组件的文件夹“test”。但是,当我尝试将此组件添加到 my-app 组件模板时,出现错误:

Error in src/main.ts (15:5)
'app-test' is not a known element:
1. If 'app-test' is an Angular component, then verify that it is included in the '@Component.imports' of this component.
2. If 'app-test' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@Component.schemas' of this component to suppress this message.
Run Code Online (Sandbox Code Playgroud)

验证它是否包含在进口中

如果我进一步添加导入,则会收到另一个错误:

Error in src/main.ts (10:27)
The component 'TestComponent' appears in 'imports', but is not standalone and cannot …
Run Code Online (Sandbox Code Playgroud)

angular stackblitz

2
推荐指数
1
解决办法
1936
查看次数

在Stackblitz上的Angular中加载本地JSON

总体来说,这很简单:

import data from './data.json';
Run Code Online (Sandbox Code Playgroud)

但是,这在Stackblitz Angular项目不起作用

链接的项目记录以下内容:

preview-3a0c9433aa42f56dbd90b.js:1 SyntaxError: Unexpected token o in JSON at position 1
Run Code Online (Sandbox Code Playgroud)

javascript typescript angular stackblitz

1
推荐指数
1
解决办法
362
查看次数

如何使用 Material Design MatTableModule 修复 stackblitz ngcc 错误?

在查看了我自己的项目配置和这个示例的配置之间的所有内容后,我不知道为什么会出现错误:

turbo_modules/@angular/material@9.2.4/table/table-module.d.ts 中的错误 (8:22)

出现在 MaterialModule 的 NgModule.exports 中,但无法解析为 NgModule、Component、Directive 或 Pipe 类。

这可能意味着声明 MatTableModule 的依赖项 (@angular/material/table) 没有被 ngcc 正确处理。

图片来自 Stackblitz:

在此处输入图片说明

angular-material angular stackblitz

1
推荐指数
1
解决办法
838
查看次数