Denis, I'm sure it is possible in other ways. However, the service way I suggested has several benefits. It makes a clear separation of what data is coming from backend. It can be used for initialising complex data from backend whereas ng-init is more appropriate for simple initialisation (like editorVisible=false). It is great as a general way of using data from backend without performing a separate request for it. It can be mocked too, of course.— Daniel
On Tue, Mar 11, 2014 at 4:52 PM, Denis Ipatov <[email protected]> wrote: > Hm, vary strange. I tried different combinations with quotes in Visual > Studio but no effect. > What the optimal approach to initialize data? Only way is making serviese > like in the first topic answer by Daniel Lidström? > Dennis, >> >> Here is a small plunker to show you how it can be done. >> http://plnkr.co/edit/eauguSJOoATrATATwn6E?p=preview >> >> Regards >> Sander >> > -- > You received this message because you are subscribed to a topic in the Google > Groups "AngularJS" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/angular/LMYhR-CE5Ps/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/angular. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
