matth3o matth3o - 2 months ago 20
Dart Question

dart angular2 - function in sub-component

I do not manage to call a function within the template of a subcomponent :

For instance, the following doesn't work :

<button onclick="{{myFunction()}}">


Nothing is displayed, I have the error : Could not find asset MyOuterComponent.dart.js

Thanks for your help

Van Van
Answer

Wrapping something with curly braces {{}} is an expression. It is meant for printing a value. What you are trying to do is calling a function. SO just remove the curly braces and assign it with ng-click e.g:

<button (click)="myFunction()">Save</button>

Hope this helps

Comments