Skip to content

Commit

Permalink
Handle Angular Promises. Fix #57
Browse files Browse the repository at this point in the history
  • Loading branch information
Pasvaz committed Feb 12, 2014
1 parent 9dd8b52 commit b3ef1b4
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion bindonce.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,19 @@
var value = (attrs.bindonce) ? scope.$eval(attrs.bindonce) : true;
if (value !== undefined)
{
bindonceController.runBinders();
// since Angular 1.2 promises are no longer
// undefined until they don't get resolved
if (value.then && typeof value.then === 'function')
{
value.then(function ()
{
bindonceController.runBinders();
});
}
else
{
bindonceController.runBinders();
}
}
else
{
Expand Down

0 comments on commit b3ef1b4

Please sign in to comment.