Angular 2,输入错误

时间:2017-06-28 14:18:50

标签: html angular typescript

我正在尝试将panel-tres更改为coincidencia,但是当我尝试执行此错误时

我没有成功尝试改变,可能是什么错误?

这个组件1



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

@Component({
  selector: 'app-panel-tres',
  templateUrl: './panel-tres.component.html',
  styleUrls: ['./panel-tres.component.css']
})
export class PanelTresComponent implements OnInit {
  tituloGestionTelefonica: string;


  constructor() {

    this.tituloGestionTelefonica = "Titulo1";
}

  ngOnInit() {

  }

}




这是组件2



import {
  Component,
  OnInit,
  Input
} from '@angular/core';
import {
  PanelTresComponent
} from '../../panel-tres/panel-tres.component'

@Component({
  selector: 'app-coincidencia',
  templateUrl: './coincidencia.component.html',
  styleUrls: ['./coincidencia.component.css']
})
export class CoincidenciaComponent implements OnInit {
  @Input()
  panelTresComponent: PanelTresComponent;

  constructor() {}

  ngOnInit() {}

}




这是组件2的html



<div class="small-6 columns">
  <span>{{panelTresComponent.tituloGestionTelefonica}}</span>
</div>
&#13;
&#13;
&#13;

这是错误

&#13;
&#13;
ERROR TypeError: Cannot read property 'tituloGestionTelefonica' of undefined
    at Object.eval [as updateRenderer] (CoincidenciaComponent.html:8)
    at Object.debugUpdateRenderer [as updateRenderer] (core.es5.js:13173)
    at checkAndUpdateView (core.es5.js:12322)
    at callViewAction (core.es5.js:12680)
    at execComponentViewsAction (core.es5.js:12612)
    at checkAndUpdateView (core.es5.js:12323)
    at callViewAction (core.es5.js:12680)
    at execComponentViewsAction (core.es5.js:12612)
    at checkAndUpdateView (core.es5.js:12323)
    at callViewAction (core.es5.js:12680)
&#13;
&#13;
&#13;

如果你能帮助我,我将不胜感激

0 个答案:

没有答案