After i click to play or pause button it is working properly, but when i change the isPlaying variable from an event listener, then the *ngIf is not working, how can i refresh it (without full page refresh or anything like that)?
The .bind(this) do the trick, as i mentioned it is working. The variable will be false, but the icon stay on pause. *ngIf needs a refresh, but i do not know (forgot) how. I think the problem that the *ngIf has not been called after an on event.
I read that the *ngIf create a new scope, so maybe it can be the problem, but i do not know how to use $parent in Ionic 2.
However, thanks, do you know how to use $parent maybe?
*ngIf checks for changes on it’s own, you don’t need to do anything. I’m pretty confident it’s just a this issue
An arrow function expression has a shorter syntax than a function expression and does not bind its own this, arguments, super, or new.target. These function expressions are best suited for non-method functions, and they cannot be used as constructors.
##Basic Syntax
(param1, param2, ..., paramN) => { statements }
(param1, param2, ..., paramN) => expression
// equivalent to: (param1, param2, ..., paramN) => { return expression; }
// Parentheses are optional when there's only one parameter:
(singleParam) => { statements }
singleParam => { statements }
// A function with no parameters requires parentheses:
() => { statements }
() => expression // equivalent to: () => { return expression; }
Thanks, i tried this and still not working, because it is equivalent to the .bind().
(However i had to search a lot when i had this problem, i was happy when i found the .bind() function, but which you mentioned, that is better, and i will use it.)