Moved autoGrow function into directive