A
A
Anton Ivanov2015-08-04 03:05:36
Angular
Anton Ivanov, 2015-08-04 03:05:36

How to overcome glitches with block sizes in angularjs?

Hello.
The bottom line is that charts are used on the '/dashboard' location.
If you open the site with this location, then everything is in order. If you come to this location from a different path, then the graphs are displayed with standard sizes (400 by 600, sort of, but not the point).
It helps to call $(window).resize() 100 milliseconds after the controller is executed, but it's a crutch :)
The same glitch with google maps.
What is the right thing to do in such a situation?
Thanks in advance

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Kononenko, 2015-08-06
@premas

Make a directive that displays the graph. This is the best way.
As for the time, you miraculously picked up these 100ms) I assure you, on weaker machines it will no longer be 100. If you don’t want to write a directive, then at least inject the $timeout service and instead of setTimeout call:
$timeout(function(){$(window).resize()})

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question