Mindaugas Mindaugas - 18 days ago 12
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.

Answer

You can actually use the native JavaScript bind.

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

is the same as

var boundFunction = myFunction.bind(this);
Comments