我的控制器有一个我想要在页面中包含的组件列表。这些其他组件是独立创建并正常工作的。
在我的 HTML 模板中:
<ng-container *ngFor="let component of components">
<div {{component.name}}></div>
</ng-container>
Run Code Online (Sandbox Code Playgroud)
代码应该输出<div>这样的:
<div my-component></div>
Run Code Online (Sandbox Code Playgroud)
但事实并非如此,我收到此错误:
DOMException: Failed to execute 'setAttribute' on 'Element'
Run Code Online (Sandbox Code Playgroud)
如果我只是在 div 标签内打印值,它会很好地工作:
<div>{{component.name}}</div>
Run Code Online (Sandbox Code Playgroud)
甚至有可能实现我想要的吗?
我正在创建Google Chrome扩展程序(我的第一个扩展程序),并且我希望将扩展程序中的邮件发送到当前选项卡.
我正在关注文档:
https://developer.chrome.com/apps/runtime#event-onMessage
该扩展将一个小的外部JS加载到选项卡的HTML中,该HTML包含以下代码:
chrome.runtime.onMessage.addListener(
function(request, sender, sendResponse) {
console.log(request)
}
);
Run Code Online (Sandbox Code Playgroud)
加载JS后,我收到以下错误:
Uncaught TypeError: Cannot read property 'onMessage' of undefined.
打开控制台和键入chrome,我可以看到运行时不是属性chrome.
看起来我做错了什么,但是什么?我需要在manifest.json文件中添加内容吗?
Chrome版本39.0.2171.71米
谢谢.
我试图基于这个例子创建一个D3旭日形图:
https://bl.ocks.org/maybelinot/5552606564ef37b5de7e47ed2b7dc099
我希望创建的弧线可以关闭整个圆圈,但它们不会.
出于测试目的和简单性,相同深度中每个元素大小的总和等于360.
跟随我的jsFiddle:
https://jsfiddle.net/igasparetto/uz8rz13d/
有些东西告诉我问题在于这些问题:
var partition = d3.partition();
var arc = d3.arc()
.startAngle(function(d) { return Math.max(0, Math.min(2 * Math.PI, x(d.x0))); })
.endAngle(function(d) { return Math.max(0, Math.min(2 * Math.PI, x(d.x1))); })
.innerRadius(function(d) { return Math.max(0, y(d.y0)); })
.outerRadius(function(d) { return Math.max(0, y(d.y1)); });
Run Code Online (Sandbox Code Playgroud)
谢谢
这直到昨天才有效,所以我相信 typescript 或 dhtmlxgantt 上发生了一些变化。
我在编译时遇到这些错误:
error TS2306: File 'projectPath/node_modules/@types/dhtmlxgantt/index.d.ts' is not a module.
src/app/shared/components/gantt/gantt.component.ts(11,17): error TS6137: Cannot import type declaration files. Consider importing 'dhtmlxgantt' instead of '@types/dhtmlxgantt'
我也尝试使用他们的演示代码并遇到相同的错误: https: //github.com/DHTMLX/angular2-gantt-demo
有没有人遇到过同样的问题并且可以阐明一些?