My component structure is like this
Parent.ts
@Component({
template: `
<div *ngFor="let i of optionCollection; let index = index; trackBy: trackByFn">
<Child></Child>
<button type="submit" class="btn btn-primary">Create</button>
</div>
`,
})
export class Parent {
}
Child.ts
@Component({
selector: 'Child'
template: `
<input />
`,
})
export class Child {
indexValueFromParent:any
}
How can I pass index value of the parent to the child component and assign that value to child's var indexValueFromParent