Hello Tom Can you share what you follow in this case?
I have same what situation. It will help full to me. Thanks & Regards Gaurav Ashara On Monday, May 13, 2013 at 2:26:17 PM UTC+5:30, Tom Green wrote: > > Hi guys, > > I’m exploring angular right now and like it a lot. But I’m not sure what > the best way to write reusable components is. Here my question: > > I want to create reusable component that: > > - Display some data > - Capture some input from the user > - Talk to the backend to load additional Data > - Get some initial data from the embedding view > > > I want to create a dashboard that contains several widgets. These widgets > are the same component but get initialized with different data. It looks > something like this: > > -------------------------------------------------------------------------- > | Dashboard component | > |------------------------------ ------------------------------ | > || Widget(a) | |Widget(b) || > |----------------------------- --------------------------------| > |------------------------------ ------------------------------ | > || Widget(c) | |Widget(d) || > |----------------------------- --------------------------------| > -------------------------------------------------------------------------- > > How would you achieve this? > > My current thoughts: > > Directives > > Plus: Good reuse and I can easily access attributes > > Minus: more the kind of a small component, how would I use Controllers or > Services to call the backend? > > > Controllers: > > Plus: Good access to services (DI), could be parameterized with ng-init > > Minus: It’s only the code part. How would I bundle the view? Use > ng-include? > > Beside of that I’m not sure how multiple controllers and nesting them > would result in some problems. > > > > Kind regards > > Tom > -- 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.
