Hi Hoàng,
Well, the best way to clean this up is what the article is telling you about injecting the needed data on the server, this will save you an extra request also.
If really can't include this using the server, you can still do it, but do not use angular for the processing of your data. You can get by with user $http via the injector, but I don't like that too much either.
It is possible to to, and you have found the way already. It's a bit of a kludge, but there is no way (aside from above methods) around it. You need the timeout, because angular needs to finish at least 1 digest cycle before everything is settled enough for your solution to work.
Does that make it more clear?
Regards
Sander