Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/31.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 为什么在角度2中不渲染行?_Angularjs_Angular_Angular2 Routing - Fatal编程技术网

Angularjs 为什么在角度2中不渲染行?

Angularjs 为什么在角度2中不渲染行?,angularjs,angular,angular2-routing,Angularjs,Angular,Angular2 Routing,我正在尝试使用inputattr将数据从一个组件发送到另一个组件。 但我得到了这个错误 VM575 zone.js@0.6.17?main=browser:484 Unhandled Promise rejection: Template parse errors: Can't bind to 't' since it isn't a known property of 'row-item'. 1. If 'row-item' is an Angular component and it has

我正在尝试使用
input
attr将数据从一个组件发送到另一个组件。 但我得到了这个错误

VM575 zone.js@0.6.17?main=browser:484 Unhandled Promise rejection: Template parse errors:
Can't bind to 't' since it isn't a known property of 'row-item'.
1. If 'row-item' is an Angular component and it has 't' input, then verify that it is part of this module.
2. If 'row-item' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schema' of this component to suppress this message.
 ("          <ul>
                 <li *ngFor="let tt of todoService.todos">
                <row-item [ERROR ->][t]='tt'></row-item>
                  </li>
VM575区域。js@0.6.17?main=浏览器:484未处理的承诺拒绝:模板分析错误:
无法绑定到“t”,因为它不是“行项目”的已知属性。
1.如果“行项目”是一个角度组件,并且具有“t”输入,则验证它是否是此模块的一部分。
2.如果“row item”是Web组件,则将“CUSTOM_ELEMENTS_SCHEMA”添加到此组件的“@NgModule.SCHEMA”以抑制此消息。
(“
    ][t] ='tt'>
我在我的演示中添加了这个

import {Component, Input} from "@angular/core";
@Component({
  selector:'row-item',
  template :`<div>
 <span>{{t}}</span>
</div>`
})
export class TodoRow{
  @Input t;
}
从“@angular/core”导入{Component,Input}”;
@组成部分({
选择器:'row-item',
模板:`
{{t}
`
})
导出类TodoRow{
@输入t;
}
像这样使用

@Component({
    selector: 'todo-list',
    template: `<div>
                <ul>
                 <li *ngFor="let tt of todoService.todos">
                <row-item [t]='tt'></row-item>
                  </li>
                    </ul>
                   </div>`
})
@组件({
选择器:“待办事项列表”,
模板:`
` })
这是我的密码
您的声明应该是这样的:

@Input() t;

您的声明应该是这样的:

@Input() t;
为组件定义输入时忘记添加()

import {Input} from '@angular/core';

Input() t;
在为组件提供输入时,应尝试提供基本名称:

@Input('t') t;
希望这有帮助。

在为组件定义输入时,您忘记添加()

import {Input} from '@angular/core';

Input() t;
在为组件提供输入时,应尝试提供基本名称:

@Input('t') t;
希望这有帮助。

@Input('t')t;
@Input('t')t;