@William_Wallace wrote:
Hey guys,
got an "overall"-Question for some controller, factory and Pull-To-Refresh things.In my app I have a long list with elements that gets loaded via http.get in an factory. Also in that view I got a pull to Refresh which works really good.
Now I was thinking about some code-optimizing and for now I have some double code in my controller. On the first init of the controller I call the factory and do some stuff with the returned JSON.
And in my doRefresh()-Function I do quite the same. So that is some double-code. And I like to know, is there a better way?
A simple way would be just to say "Ok, on Refresh, just reinitiate the controller". But all solutions I found for that were kind of strange. Like state.go... and stuff like that. Another idea was to set the code to an own factory, then I can use that in doRefresh and on the first init of the controller.
Does anybody has an good or better solution? Or is it just that way.
Posts: 1
Participants: 1