Skip to content

Instantly share code, notes, and snippets.

@listrophy
Last active July 12, 2017 20:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save listrophy/0c553fd5842cece036af9331690a1216 to your computer and use it in GitHub Desktop.
Save listrophy/0c553fd5842cece036af9331690a1216 to your computer and use it in GitHub Desktop.
Trying to call an Angular Component's method in the template
@Component({
selector: 'my-component',
template: `
<my-component [value]="someValue">
<!-- Does not work -->
<div>{{aFunctionThatExistsInMyComponent()}}</div>
</my-component>`
})
export class MyComponent {
value: string;
aFunctionThatExistsInMyComponent() {
return "I wish this worked";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment