Mindaugas Mindaugas - 6 months ago 71
AngularJS Question

Does Angular JS have an equivalent of dojo.hitch()

Forgive my ignorance as I am not as familiar with Angular js. Is there an equivalent to dojo.hitch()? It returns a function that is guaranteed to be executed in the given scope.


You can actually use the native JavaScript bind.

var boundFunction = lang.hitch(this, myFunction);

is the same as

var boundFunction = myFunction.bind(this);