Ionic 5 Full Starter App
  • Enappd Apps
  • Ionic 5 Full App
    • What is Ionic 5 Full App?
    • Template Features
    • Initial Setup
      • Environment Configuration
      • Credentials
    • Running the app
    • Deploying app as PWA
    • Building App on device
    • How to use this template?
      • Copy a module to another app
      • Shared Component & Modules
      • Map Service
    • Beginner Pack Features
      • Firebase
      • Layouts
      • Sidemenus
      • Login and Signups
      • Chat screens
      • Chat Lists
      • Video Playlists
      • Grids and Lists Layouts
    • Startup Pack Features
      • Wordpress
        • Wordpress JSON API Basics
        • Wordpress in Ionic 5 Full App
      • Translation - Multi-language
      • Using Custom Fonts
      • Infinite scroll
      • Content Loaders
      • Pull to refresh
      • List re-ordering
      • Date Pickers
    • Pro Pack Features
      • Phaser Game Framework
      • AdMob Integration
        • AdMob Introduction
        • Setting up Google Admob
        • Integration
      • Social Sharing
      • QR and Barcode Scanning
      • Google Places
      • Google Autocomplete
      • Social Logins
        • Google Login
        • Facebook Login
        • Twitter Login
      • Woo-commerce Integration
    • Removing a Page / Component
    • Removing a plugin
    • FAQs
    • Changelog
    • Troubleshoot
Powered by GitBook
On this page
  • Shared Modules
  • Shared Components

Was this helpful?

  1. Ionic 5 Full App
  2. How to use this template?

Shared Component & Modules

Handling the sharing of common code

PreviousCopy a module to another appNextMap Service

Last updated 3 years ago

Was this helpful?

Shared Modules

In some cases, the pages use Shared modules. For example, the Instagram Home page and Profile page contains the component instagram which is the scrollable images gallery, imported from src/app/components using shared-module.module.ts . This type of sharing is useful where the same component is required in multiple pages.

If you want to use any of these common components outside of the copied module, just move the shared-module.module.ts to a parent directory level, and then share the component via it.

Imported components look like an HTML tag, something like this

<instagram></instagram>

Read more about routing in Angular in .

Shared Components

To modularize and make code in smaller pieces, some code pieces are put as components. These components make it easy to separate small feature development, and handle each individually.

For example, the layout-components -> card-sliders-layout -> components has 5 components which are further used in sliders page in the same module. Since the components are used only in one page, there is no need of a shared module. The component can just be imported in the module.ts file of the page, and then can be used in the page HTML as <app-slider1></app-slider1> etc.

official documentation here