> For the complete documentation index, see [llms.txt](https://enappd.gitbook.io/ionic-4-spotify-style-template/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://enappd.gitbook.io/ionic-4-spotify-style-template/how-to-use-this-template-1/modifying-code.md).

# Modifying Code

How to navigate and modify the code

## **Screen / View’s Code Structure**

![](https://812711768-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lqea4846K1EF_JYP5b0%2F-LqeaeMNtY8bL_ztQSq_%2F-LqegQgcmZkxqxAqe6yk%2FScreen%20Shot%202019-10-08%20at%202.57.08%20PM.png?alt=media\&token=743737e5-83cb-4ae2-bd71-72e28113982a)

## **Overall Folder Structure**

There are broadly **2**0+ pages in this template. All pages are shown in the src/app folder above. Mostly, each page’s code is kept in a separate folder. Folder names are self-explanatory. You can create a page by executing the command

```
$ ionic cordova generate page your_page_name
```

This will create a folder of page name containing four files as -

In the case of Ionic 4, pages are generated with lazy loading by default which means a page has its own module.

```
├── enappd.html
├── enappd.module.ts
├── enappd.scss
└── enappd.ts
```

* `enappd.html`: contains UI components for the page.
* `enappd.scss`: contains sass styles to style your page.
* `enappd.ts`: contains TypeScript code

## **Layout File Code Structure**

The layout file has the structure shown in the image.

• imports are written on the top.

• @component is the decorator that marks a class as an Angular component and provides configuration metadata that determines how the component should be processed, instantiated, and used at runtime.

• A constructor is used for dependency injections.

When the app loads the constructor gets called first then `ngOnInit`.

After constructor and inside the class we can write our logic for the page/component in `page.ts`

![](https://812711768-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lqea4846K1EF_JYP5b0%2F-LqeaeMNtY8bL_ztQSq_%2F-Lqegh9AacZr2_leqJuN%2FScreen%20Shot%202019-10-08%20at%202.58.20%20PM.png?alt=media\&token=14ef61ee-7cea-4c4b-8409-f9fc6cb166b0)

## **Styling**&#x20;

![](https://812711768-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lqea4846K1EF_JYP5b0%2F-LqeaeMNtY8bL_ztQSq_%2F-Lqegv3pRHOMQxm_LzxD%2FScreen%20Shot%202019-10-08%20at%202.58.55%20PM.png?alt=media\&token=3edcd3e6-9797-400a-8133-109e0fd191a6)

Style pages are generated by default for each page after executing page generate command, inside the page folder.

## **Navigation Code Structure**

![](https://812711768-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lqea4846K1EF_JYP5b0%2F-LqeaeMNtY8bL_ztQSq_%2F-Lqeh-HIeV6c0rrcuLJD%2FScreen%20Shot%202019-10-08%20at%202.59.37%20PM.png?alt=media\&token=ad1c2597-e108-4f86-a202-9fb06e5a8b23)

On creating a project in Ionic4 a file named `app-routing.module.ts` gets generated by default where all the navigation codes get done.\
We use the path name of a particular page to navigate from one page to another.-

## **Tabbed navigation**

![](https://812711768-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lqea4846K1EF_JYP5b0%2F-LqeaeMNtY8bL_ztQSq_%2F-LqehOa-kcCJ_f0LOZn8%2FScreen%20Shot%202019-10-08%20at%203.01.22%20PM.png?alt=media\&token=3d1195d1-d46f-409f-a11e-77d1385fe925)

Navigation for the Tabs is defined in `tabs/tabs.router.module` file. All the children of tabs are inside the tab navigation as well

## **Nested Segment navigation**

![](https://812711768-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lqea4846K1EF_JYP5b0%2F-LqeaeMNtY8bL_ztQSq_%2F-Lqel6spGtN1Ln4CoSnR%2FScreen%20Shot%202019-10-08%20at%203.17.35%20PM.png?alt=media\&token=0b12af96-20dd-4d86-aed3-5debb4a083fb)

Controls the navigation of Segments (2 Segment buttons in the Library page). This is detailed in `src/app/library`folder. All the settings of Segment Navigation can be controlled from here.
