Open iranreyes opened 8 years ago
ok :+1:
@iranreyes I'm still wrapping my head around the componentized approach so bear with me. Will service be at the component level in this case or more at the core level to be shared across components?
@adyngom Mainly depend of the responsibility of the service, if the service is just for the component will be inside it. This is very common because the goal is develop with OOP and SoC, so you should not write many logic in your controllers. And if the services are more general, are located in the core. You can see them like a layer, for example data access layer, UI sync layer, etc
@iranreyes :100: makes sense - it would be great to see then how a core service such as login, authentication and such will fit and be accessed in this structure. The component based service might be pretty straightforward and maybe extending the generator to have it part of the default files would be a great add as well.
Login could be a module too, a set of components and service that you can use in your app. Imagine like a reusable module....
@gdi2290 I can't do pull-request because I don't have permissions. I have tried with several but without success.
Ok so after taking a closer look doesn't the 'user' module that is provided in the app boilerplate satisfy both use cases of having a component service, and that same module can easily be imported and used on other modules that need it?
@iranreyes want to pair on it tomorrow via google hangout?
@gdi2290 Hi, yes we can do it tomorrow, I am available almost all day, but between 11am - 4pm it is perfect for me. I am in Montevideo, Uruguay so I am in UTC/GMT-3 hours. I think that you are 6 hours less.
@gdi2290 , @iranreyes I prepared a todomvc example: https://github.com/fesor/todomvc-angular-components
it has service example (will add store service tonight), stateless components, some tests and so on. I will appreciate any feedback from you.
@fesor can you include a link in the readme about it?
@gdi2290 when it will be ready. Also I'd like to get as more feedback as possible to make this example more useful.
Added link to AngularClass/ng6-todo-starter in readme.
There is example of service and how to test them.
@fesor The structure in your todo is different from the NG6-starter. Is there any chance you can write an example with the NG6-starter logic?
@yairneumann11 the only difference is that i don't split all the things into different files (i.e. templates, controllers, components). This shouldn't be a problem, if it is, please ask questions.
I prefer to use inline template to force developers write small templates and make all the things in reusable components.
As for controllers - I just don't see any profit of splitting this up. Event for testing purposes - you can just export it from component module (just like I did). In real-life project you will have a lot of them and have 7 (controller, component definition, template, styles, tests, maybe e2e tests) files just for one component... I'm just to lazy.
@fesor, I undertand your preference, but you write an example to people who still learning, like me, and confuses me a lot when I trying understand a logic and in another project with use the same boilerplate is diferent, if you can rewrite the code to follow NG6 pattern, will help a lot new guys like me. This is a diference between encourage and scare newbies.
This is just a feedback from a guy who is learning.
@iranreyes can you make a pull-request of a simple one?