0

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!

Community
  • 1
  • 1
wardanuy
  • 56
  • 1
  • 6
  • Would it be possible for you to create a small example of your situation in a JSFiddle? – camiblanch Dec 29 '15 at 21:59
  • Did you try calling resize on the div instead of on the window? I had to call jQuery('#bodyDIV').resize(); instead of resizing the window in one instance to get my verify button in the right position. – Samurai Soul Jan 09 '16 at 00:12

1 Answers1

0

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);

wardanuy
  • 56
  • 1
  • 6