не работает `router-outlet` в` app-component` - PullRequest
0 голосов
/ 14 мая 2018

Я пытаюсь связаться с одной из страниц router-oulet с родительским компонентом как app component, но не работает.

вот мой код:

home.component.ts:

import {Component, OnInit, Output, EventEmitter} from '@angular/core';

@Component({
  templateUrl:"home.component.html"
})

export class HomeComponent implements OnInit {

  @Output() myEmiter = new EventEmitter<string>();

  ngOnInit(){}

  sendMessage(msg){
    this.myEmiter.emit(msg);
  }

}

В приложении component.ts:

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

@Component({
  selector: 'my-app',
  templateUrl: './app.component.html',
  styleUrls: [ './app.component.css' ]
})
export class AppComponent  {
  name = 'Angular 6';
  @Input() msg:string = "default"; //msg not updating at all
}

Демонстрационная версия

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...