📜  来自组件的角度传递模板值 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:44.434000             🧑  作者: Mango

代码示例1
// Component //

export class MyComponent implements onInit {
  // define vars
  shownSetting: string;

  ngOnInit() {
    this.myMethod();
  }

  myMethod() {
    return xyz.length > 0 ? this.shownSetting = "Blue" : this.shownSetting = "Green";
  }
}


// Template //

{{shownSetting}}