AngularJS: cleanest way to fix jQuery bug without updating the DOM in the controller -
i happened hit this bug in angular app (which uses codef0rmer's dragdrop wrapper around jquery ui's draggable.
it's tempting put prevailing best solution answer
$('body').css('cursor', 'auto');
at end of controller function handles stop
event.
it's quick, simple, works charm , unlikely cause issues because doesn't update models or bits of dom linked models.
on other hand, fear angular police come after me.
so what's "angular" way this?
if codef0rmer's wrapper own, i'd hack in fix there. don't want mess plugin. default answer be
- in
stop
event function in controller, setdragstopped
flag instead - create whole directive listens
dragstopped
change css property, , - add directive every draggable element
but seems ridiculous overkill
use ng-style. in body tag, put
ng-style="{cursor: cursorcss}"
in controller
$scope.cursorcss = 'auto';
Comments
Post a Comment