Skip to content

Commit af30b35

Browse files
committed
refactor(app): create components and pipe modules
1 parent 59db5e6 commit af30b35

File tree

6 files changed

+81
-44
lines changed

6 files changed

+81
-44
lines changed

src/app/app.imports.ts

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,6 @@ import { GoogleMaps } from '@ionic-native/google-maps';
2121
import { SlidingDrawer } from '../components/sliding-drawer/sliding-drawer';
2222
import { Autosize } from '../components/autosize/autosize';
2323

24-
// Components
25-
import { Timer } from '../components/countdown-timer/timer';
26-
import { TimerProgress } from '../components/timer-progress/timer-progress';
27-
import { ExpandableHeader } from '../components/expandable-header/expandable-header';
28-
import { FlashCardComponent } from '../components/flash-card/flash-card';
29-
import { AccordionListComponent } from '../components/accordion-list/accordion-list';
30-
import { TimelineComponent } from '../components/timeline/timeline';
31-
import { TimelineItemComponent } from '../components/timeline/timeline';
32-
import { TimelineTimeComponent } from '../components/timeline/timeline';
33-
34-
// Pipes
35-
import { MomentPipe } from '../pipes/moment.pipe';
36-
import { TemperaturePipe } from '../pipes/temperature.pipe';
37-
import { OrderByPipe } from '../pipes/orderby.pipe';
38-
import { ShortenStringPipe } from '../pipes/shorten.pipe';
39-
import { CapitalizePipe } from '../pipes/capitalize.pipe';
40-
4124
// Modules
4225
import { SwingModule } from 'angular2-swing';
4326
import { BrowserModule } from '@angular/platform-browser';
@@ -49,14 +32,6 @@ export const MODULES = [
4932
HttpModule,
5033
];
5134

52-
export const PIPES = [
53-
TemperaturePipe,
54-
MomentPipe,
55-
OrderByPipe,
56-
CapitalizePipe,
57-
ShortenStringPipe
58-
];
59-
6035
export const PROVIDERS = [
6136
AlertService,
6237
ToastService,
@@ -75,20 +50,7 @@ export const PROVIDERS = [
7550
GoogleMaps,
7651
];
7752

78-
export const COMPONENTS = [
79-
FlashCardComponent,
80-
TimerProgress,
81-
Timer,
82-
ExpandableHeader,
83-
Autosize,
84-
AccordionListComponent,
85-
TimelineComponent,
86-
TimelineItemComponent,
87-
TimelineTimeComponent
88-
];
89-
9053
export const DIRECTIVES = [
9154
SlidingDrawer,
92-
Timer,
9355
Autosize,
9456
];

src/app/shared.module.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
1-
import { COMPONENTS, DIRECTIVES, PIPES } from './app.imports';
1+
import { PipesModule } from '../pipes/pipes.module';
2+
import { ComponentsModule } from '../components/components.module';
3+
import { DIRECTIVES } from './app.imports';
24
import { NgModule } from '@angular/core';
35
import { IonicModule } from 'ionic-angular';
46

57
@NgModule({
68
declarations: [
7-
PIPES,
89
DIRECTIVES,
9-
COMPONENTS
1010
],
1111
imports: [
1212
IonicModule,
13+
PipesModule,
14+
ComponentsModule,
1315
],
1416
exports: [
15-
PIPES,
16-
COMPONENTS
17+
ComponentsModule,
18+
PipesModule,
1719
]
1820
})
1921

src/components/components.module.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { NgModule } from '@angular/core';
2+
import { IonicModule } from 'ionic-angular';
3+
4+
import { Timer } from './countdown-timer/timer';
5+
import { TimerProgress } from './timer-progress/timer-progress';
6+
import { ExpandableHeader } from './expandable-header/expandable-header';
7+
import { FlashCardComponent } from './flash-card/flash-card';
8+
import { AccordionListComponent } from './accordion-list/accordion-list';
9+
import { TimelineComponent, TimelineItemComponent, TimelineTimeComponent } from './timeline/timeline';
10+
11+
export const components = [
12+
Timer,
13+
TimerProgress,
14+
ExpandableHeader,
15+
FlashCardComponent,
16+
AccordionListComponent,
17+
TimelineComponent,
18+
TimelineItemComponent,
19+
TimelineTimeComponent,
20+
];
21+
22+
@NgModule({
23+
declarations: [components],
24+
imports: [IonicModule],
25+
exports: [components]
26+
})
27+
export class ComponentsModule {}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { IonicModule } from 'ionic-angular';
2+
import { NgModule } from '@angular/core';
3+
import {
4+
TimelineComponent,
5+
TimelineItemComponent,
6+
TimelineTimeComponent
7+
} from './timeline';
8+
9+
export const components = [
10+
];
11+
12+
@NgModule({
13+
declarations: [
14+
TimelineComponent,
15+
TimelineItemComponent,
16+
TimelineTimeComponent,
17+
],
18+
imports: [IonicModule],
19+
exports: [
20+
TimelineComponent,
21+
TimelineItemComponent,
22+
TimelineTimeComponent,
23+
]
24+
})
25+
export class TimelineComponentModule {}

src/pages/_home/home.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ <h3>Advanced Ionic 2 Components</h3>
1717
which are really great.
1818
</p>
1919
<button class="pop-in" ion-button secondary menuToggle>Toggle Menu</button>
20-
2120
</ion-content>
2221

2322
<!--<sliding-drawer [options]="drawerOptions">

src/pipes/pipes.module.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { NgModule } from '@angular/core';
2+
3+
import { CapitalizePipe } from './capitalize.pipe';
4+
import { MomentPipe } from './moment.pipe';
5+
import { OrderByPipe } from './orderby.pipe';
6+
import { ShortenStringPipe } from './shorten.pipe';
7+
import { TemperaturePipe } from './temperature.pipe';
8+
9+
export const pipes = [
10+
CapitalizePipe,
11+
MomentPipe,
12+
OrderByPipe,
13+
ShortenStringPipe,
14+
TemperaturePipe,
15+
];
16+
17+
@NgModule({
18+
declarations:[pipes],
19+
exports: [pipes]
20+
})
21+
22+
export class PipesModule { }

0 commit comments

Comments
 (0)