We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
子组件选择器写成属性选择器即可,传值和普通传值一致。
父组件
import {Component } from '@angular/core'; @Component({ selector: 'app', template: ` <table> <tr myTd *ngFor="let animal of animals" [animal]="animal"></tr> </table> ` }) export class AppComponent { animals = [ '猫', '狗' ]; }
子组件
import {Component, Input} from '@angular/core'; @Component({ selector: '[myTd]', template: `<td >{{animal}}</td>` }) export class MyTdComponent { @Input() animal; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
带有属性选择器的组件
子组件选择器写成属性选择器即可,传值和普通传值一致。
The text was updated successfully, but these errors were encountered: