<commit_before>import * as _ from 'lodash';
import { Component, ViewChild } from '@angular/core';
import {
  ControlElement,
  Generate,
  JsonFormsState,
  RankedTester,
  rankWith,
  resolveSchema,
  toDataPath,
  uiTypeIs,
} from '@jsonforms/core';
import { JsonFormsControl } from '@jsonforms/angular';
import { Nav, Platform } from 'ionic-angular';
import { MasterDetailNavService } from './master-detail-nav.service';
import { MasterPage } from './pages/master/master';
import { removeSchemaKeywords } from '../../common';
import { NgRedux } from '@angular-redux/store';
import { DetailPage } from './pages/detail/detail';

@Component({
  selector: 'jsonforms-master-detail',
  template: `
      <ion-split-pane (ionChange)="onSplitPaneChange($event)">
          <ion-nav [root]="masterPage" #masterNav ></ion-nav>
          <ion-nav [root]="detailPage" #detailNav main></ion-nav>
      </ion-split-pane>
  `
})
export class MasterDetailComponent extends JsonFormsControl {

  @ViewChild('masterNav') masterNav: Nav;
  @ViewChild('detailNav') detailNav: Nav;

  masterPage: any;
  detailPage: any;

  private masterDetailService: MasterDetailNavService;
  private masterItems: any[];

  constructor(
    private parentNav: Nav,
    private platform: Platform,
    ngRedux: NgRedux<JsonFormsState>
  ) {
    super(ngRedux);
    this.masterDetailService = new MasterDetailNavService()
  }

  ngOnInit() {

    this.masterDetailService.masterNav = this.masterNav;
    this.masterDetailService.detailNav = this.detailNav;
    this.masterDetailService.parentNav = this.parentNav;

    const state$ = this.connectControlToJsonForms(this.ngRedux, this.getOwnProps());<commit_msg>Inject master detail nav service into master detail instead of creating it manually<commit_after>import * as _ from 'lodash';
import { Component, ViewChild } from '@angular/core';
import {
  ControlElement,
  Generate,
  JsonFormsState,
  RankedTester,
  rankWith,
  resolveSchema,
  toDataPath,
  uiTypeIs,
} from '@jsonforms/core';
import { JsonFormsControl } from '@jsonforms/angular';
import { Nav, Platform } from 'ionic-angular';
import { MasterDetailNavService } from './master-detail-nav.service';
import { MasterPage } from './pages/master/master';
import { removeSchemaKeywords } from '../../common';
import { NgRedux } from '@angular-redux/store';
import { DetailPage } from './pages/detail/detail';

@Component({
  selector: 'jsonforms-master-detail',
  template: `
      <ion-split-pane (ionChange)="onSplitPaneChange($event)">
          <ion-nav [root]="masterPage" #masterNav ></ion-nav>
          <ion-nav [root]="detailPage" #detailNav main></ion-nav>
      </ion-split-pane>
  `
})
export class MasterDetailComponent extends JsonFormsControl {

  @ViewChild('masterNav') masterNav: Nav;
  @ViewChild('detailNav') detailNav: Nav;

  private masterItems: any[];

  constructor(
    private parentNav: Nav,
    private platform: Platform,
    ngRedux: NgRedux<JsonFormsState>,
    private masterDetailService: MasterDetailNavService
  ) {
    super(ngRedux);
  }

  ngOnInit() {

    this.masterDetailService.masterNav = this.masterNav;
    this.masterDetailService.detailNav = this.detailNav;
    this.masterDetailService.parentNav = this.parentNav;

    const state$ = this.connectControlToJsonForms(this.ngRedux, this.getOwnProps());
{'fraction_non_alphanumeric': 0.12976869930910184, 'fraction_numerical': 0.0, 'mean_word_length': 4.397082658022691, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '673575', 'n_tokens_mistral': 1017, 'n_tokens_neox': 1002, 'n_words': 222}