1

On the official styleguide :https://angular.io/guide/styleguide#core-feature-module they recommend using a SharedModule and CoreModule in an angular app.

I was wondering if it was a decent practise to use them as well on an Ionic app ?

3 Answers 3

1

That depends on your app, if you are doing a ToDo List app you probably don't need a CoreModule.

But if you have services that must be singleton instances and you have common components that must be used along the app, this module is where you probably need to register them.

As an example think in something like a 401 HTTP status response, you could trigger an EventBus (singleton) where your pages are subscribed and they will do something to handle that status in a generic way.

Sign up to request clarification or add additional context in comments.

Comments

1

Why would it be any different ? What the angular team recommend is for any application type, be it a Ionic app or any other.

Will you need singleton services across your application ? Yes then you need something like a CoreModule to provide them and it's convenient.

Will you have shared components across several other modules ? Probably yes, like any other Angular application, so you need to have a SharedModule that will answer your needs.

Comments

0

Don't know, maybe it's not Ionic best practices? I cannot find this the super starter template (also referred as best practices)

https://github.com/ionic-team/starters/tree/master/ionic-angular/official/super

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.