Я хочу отправить данные selectedNodes из component1 (кнопка component) в component2 (модальный шаблон). Я попытался @output, но я не получаю точный поток. Я подаю в суд на angular 7, и я путаюсь между общим сервисом и angular @output decorator.
component1
@Component({
template: `
<div style="text-align:center; padding-top: 1px;">
<ng-template *ngIf="params.node.data.status === 'Submitted'; then showBlockNew; else notShowBlockNew"> </ng-template>
<ng-template #showBlockNew>
<button
placement="bottom"
tooltip="View, {{ params.node.data.securityName }}"
container="body"
type="button"
class="btn btn-sq-v btn-link"
(click)="viewEntitycall()"
>
<i class="fa fa-eye"></i>
</button>
</ng-template>
<ng-template #notShowBlockNew></ng-template>
</div>
`
})
export class LegwiseButtonComponent implements ICellEditorAngularComp, AfterViewInit { viewEntitycall() {
this.selectedNodes = this.params.node.data;
console.log(this.selectedNodes);
}
Component2
@Component({
selector: 'jhi-modal-content',
template: `
<div class="modal-header">
<h4 class="modal-title pull-left">{{ title }}</h4>
</div>
<div class="modal-body">
<ag-grid-angular
style="width: 100%; height: 450px"
class="ag-theme-balham"
#grid
[gridOptions]="gridOptions"
[columnDefs]="gridColumnDefs"
[rowData]="rowData"
[frameworkComponents]="frameworkComponents"
[getRowHeight]="getRowHeight"
></ag-grid-angular>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-success btn-sm">Update Valuation Data</button>
<button type="button" class="btn btn-default btn-sm" (click)="bsModalRef.hide()">Close</button>
</div>
`
})
export class ModalLegContentComponent implements OnInit {
ngOnInit() { // want it inside this }
}