Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

angular pass template value from component

// 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 //

<div>
  {{shownSetting}} 
</div>
 
PREVIOUS NEXT
Tagged: #angular #pass #template #component
ADD COMMENT
Topic
Name
9+7 =