Skip to content

Commit

Permalink
Avoiding infinite loop for heightless parents
Browse files Browse the repository at this point in the history
  • Loading branch information
carloshpds committed Jan 3, 2017
1 parent 4502cd6 commit 9fb8ab8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/app/components/directive.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@ angular.module("ngFillHeight.directives")

ngFillHeightOption.api = {
recalcHeight : () ->

recurrFunc = (increment) ->
currObject.height(currObject.height() + increment)

recurrFunc(10) while currObject.height() < ngFillHeightOption.minHeight or parentObject.height() >= parentObject.prop('scrollHeight')
if parentObject.prop('scrollHeight')
recurrFunc(10) while currObject.height() < ngFillHeightOption.minHeight or parentObject.height() >= parentObject.prop('scrollHeight')

recurrFunc(-1) while currObject.height() > ngFillHeightOption.minHeight and parentObject.height() < parentObject.prop('scrollHeight')
recurrFunc(-1) while currObject.height() > ngFillHeightOption.minHeight and parentObject.height() < parentObject.prop('scrollHeight')

return
return currObject.height()
}

return {
Expand Down

0 comments on commit 9fb8ab8

Please sign in to comment.