I am using SmartyStreets' LiveAddress in an angularJS application to do address validation and autofill on 2 fields in a form. When the user clicks submit, a div is created above the form with either a success or failure message. This div pushes the form down, but the smarty-ui
divs do not move, so the smarty-tag-check
divs are no longer lined up properly with their associated fields.
I tried adding angular.element($window).resize();
to my code after the success div is displayed (based on the comment in SmartyStreets jQuery element positioning breaks), but am not seeing any effect. Is this an improper way to force a window resize in AngularJS, or alternatively is there a better way to keep the smarty-ui
divs in the proper location?
Thanks!
Looks like the issue with just calling a resize with angular.element($window).resize();
was that it was performing the resize before angular had finished building the new page. I've gotten around this by adding it via a timeout instead:
$timeout(function(){angular.element($window).resize()}, 500);