javascript - Angular 2 未捕获错误 : Template parse errors:

标签 javascript angular

基本上这是我的代码:

<div class="container">
<div [hidden]="loggedIn">
<md-grid-list cols="6" [style.margin-top]="'20px'">
<md-grid-tile [colspan]="1"></md-grid-tile>

我已经将 md-input-container 添加到了我的 style.css 文件中。当我在终端中运行 Angular 2 时,它说编译成功。但是当我打开 chrome 浏览器查看实际网站时。它确实有如下错误:

Uncaught Error: Template parse errors: Can't bind to 'colspan' since it isn't a known property of 'md-grid-tile'. 1. If 'md-grid-tile' is an Angular component and it has 'colspan' input, then `verify that it is part of this module. 2. If 'md-grid-tile' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.

最佳答案

您需要将其用作,否则它将作为您需要在组件内声明的输入属性

<md-grid-tile colspan="1"></md-grid-tile>

关于javascript - Angular 2 未捕获错误 : Template parse errors:,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48555328/

相关文章:

javascript - 记录使用简单 JavaScript 继承定义的方法

javascript - 如何检查并通知用户浏览器中启用了 javascript

windows - Angular 2 如何从存储中删除列表项

javascript - 如何将进度圈限制在 60 而不是 100% 以内

angular - 无法读取 angular2 中 null 的属性 'navigate'

javascript - Angular - 提取 HTML 元素的点击信息

javascript - JS 中使用高阶函数的困惑

javascript - 我如何通过 javascript 从 MSO 代码获取链接

Angular 8 项目无法在 Microsoft Edge 和 IE11 中运行

javascript - 如何使用 React 从客户端的 Meteor 集合中检索数据?