Ver Código Fonte

add rout home+news

golf 3 anos atrás
pai
commit
5f33a84090

+ 4 - 0
src/app/app-routing.module.ts

20
     loadChildren: () => import('./navtabs/navtabs.module').then( m => m.NavtabsPageModule)
20
     loadChildren: () => import('./navtabs/navtabs.module').then( m => m.NavtabsPageModule)
21
   },
21
   },
22
   // {
22
   // {
23
+  //   path: 'news-detail',
24
+  //   loadChildren: () => import('./news-detail/news-detail.module').then( m => m.NewsDetailPageModule)
25
+  // },
26
+  // {
23
   //   path: 'youtube',
27
   //   path: 'youtube',
24
   //   loadChildren: () => import('./youtube/youtube.module').then( m => m.YoutubePageModule)
28
   //   loadChildren: () => import('./youtube/youtube.module').then( m => m.YoutubePageModule)
25
   // },
29
   // },

+ 14 - 1
src/app/app.module.ts

6
 
6
 
7
 import { AppComponent } from './app.component';
7
 import { AppComponent } from './app.component';
8
 import { AppRoutingModule } from './app-routing.module';
8
 import { AppRoutingModule } from './app-routing.module';
9
+
10
+import { HttpClientModule } from '@angular/common/http';
11
+// import { WpdataService } from './services/wpdata.service';
12
+
9
 import { FontAwesomeModule, FaIconLibrary } from '@fortawesome/angular-fontawesome';
13
 import { FontAwesomeModule, FaIconLibrary } from '@fortawesome/angular-fontawesome';
10
 import { fas } from '@fortawesome/free-solid-svg-icons'
14
 import { fas } from '@fortawesome/free-solid-svg-icons'
11
 import { far } from '@fortawesome/free-regular-svg-icons'
15
 import { far } from '@fortawesome/free-regular-svg-icons'
13
 
17
 
14
 @NgModule({
18
 @NgModule({
15
   declarations: [AppComponent],
19
   declarations: [AppComponent],
16
-  imports: [BrowserModule, IonicModule.forRoot(), AppRoutingModule, FontAwesomeModule],
20
+  imports: [
21
+    BrowserModule, 
22
+    IonicModule.forRoot(), 
23
+    AppRoutingModule, 
24
+    FontAwesomeModule,
25
+    HttpClientModule,
26
+    // WpdataService,
27
+    // HttpClient,
28
+    // HttpHeaders
29
+  ],
17
   providers: [{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy }],
30
   providers: [{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy }],
18
   bootstrap: [AppComponent],
31
   bootstrap: [AppComponent],
19
 })
32
 })

+ 1 - 1
src/app/home/home.page.html

30
       <ion-col size="5">
30
       <ion-col size="5">
31
         <img src="../../assets/img-static/SEI129887404-c4a9.jpg">
31
         <img src="../../assets/img-static/SEI129887404-c4a9.jpg">
32
       </ion-col>
32
       </ion-col>
33
-      <ion-col class="ion-align-self-center">“น้องเทนนิส” หวังคว้าแชมป์ในศึกชิงแชมป์โลก ต้นเดือนหน้า</ion-col>
33
+      <ion-col class="ion-align-self-center"><a [routerLink]="['../news-detail/']">“น้องเทนนิส” หวังคว้าแชมป์ในศึกชิงแชมป์โลก ต้นเดือนหน้า</a></ion-col>
34
     </ion-row>
34
     </ion-row>
35
     <ion-row>
35
     <ion-row>
36
       <ion-col size="5">
36
       <ion-col size="5">

+ 4 - 0
src/app/navtabs/navtabs-routing.module.ts

17
         loadChildren: () => import('../news/news.module').then( m => m.NewsPageModule)
17
         loadChildren: () => import('../news/news.module').then( m => m.NewsPageModule)
18
       },   
18
       },   
19
       {
19
       {
20
+        path: 'news-detail',
21
+        loadChildren: () => import('../news-detail/news-detail.module').then( m => m.NewsDetailPageModule)
22
+      },
23
+      {
20
         path: 'article',
24
         path: 'article',
21
         loadChildren: () => import('../article/article.module').then( m => m.ArticlePageModule)
25
         loadChildren: () => import('../article/article.module').then( m => m.ArticlePageModule)
22
       },   
26
       },   

+ 17 - 0
src/app/news-detail/news-detail-routing.module.ts

1
+import { NgModule } from '@angular/core';
2
+import { Routes, RouterModule } from '@angular/router';
3
+
4
+import { NewsDetailPage } from './news-detail.page';
5
+
6
+const routes: Routes = [
7
+  {
8
+    path: '',
9
+    component: NewsDetailPage
10
+  }
11
+];
12
+
13
+@NgModule({
14
+  imports: [RouterModule.forChild(routes)],
15
+  exports: [RouterModule],
16
+})
17
+export class NewsDetailPageRoutingModule {}

+ 20 - 0
src/app/news-detail/news-detail.module.ts

1
+import { NgModule } from '@angular/core';
2
+import { CommonModule } from '@angular/common';
3
+import { FormsModule } from '@angular/forms';
4
+
5
+import { IonicModule } from '@ionic/angular';
6
+
7
+import { NewsDetailPageRoutingModule } from './news-detail-routing.module';
8
+
9
+import { NewsDetailPage } from './news-detail.page';
10
+
11
+@NgModule({
12
+  imports: [
13
+    CommonModule,
14
+    FormsModule,
15
+    IonicModule,
16
+    NewsDetailPageRoutingModule
17
+  ],
18
+  declarations: [NewsDetailPage]
19
+})
20
+export class NewsDetailPageModule {}

+ 9 - 0
src/app/news-detail/news-detail.page.html

1
+<ion-header>
2
+  <ion-toolbar>
3
+    <ion-title>news-detail</ion-title>
4
+  </ion-toolbar>
5
+</ion-header>
6
+
7
+<ion-content>
8
+<div style="background-color:#fff; padding: auto;"><p style="color:#000;">News Deatil</p></div>
9
+</ion-content>

+ 0 - 0
src/app/news-detail/news-detail.page.scss


+ 24 - 0
src/app/news-detail/news-detail.page.spec.ts

1
+import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
2
+import { IonicModule } from '@ionic/angular';
3
+
4
+import { NewsDetailPage } from './news-detail.page';
5
+
6
+describe('NewsDetailPage', () => {
7
+  let component: NewsDetailPage;
8
+  let fixture: ComponentFixture<NewsDetailPage>;
9
+
10
+  beforeEach(waitForAsync(() => {
11
+    TestBed.configureTestingModule({
12
+      declarations: [ NewsDetailPage ],
13
+      imports: [IonicModule.forRoot()]
14
+    }).compileComponents();
15
+
16
+    fixture = TestBed.createComponent(NewsDetailPage);
17
+    component = fixture.componentInstance;
18
+    fixture.detectChanges();
19
+  }));
20
+
21
+  it('should create', () => {
22
+    expect(component).toBeTruthy();
23
+  });
24
+});

+ 15 - 0
src/app/news-detail/news-detail.page.ts

1
+import { Component, OnInit } from '@angular/core';
2
+
3
+@Component({
4
+  selector: 'app-news-detail',
5
+  templateUrl: './news-detail.page.html',
6
+  styleUrls: ['./news-detail.page.scss'],
7
+})
8
+export class NewsDetailPage implements OnInit {
9
+
10
+  constructor() { }
11
+
12
+  ngOnInit() {
13
+  }
14
+
15
+}

+ 1 - 1
src/app/news/news.page.html

20
       <ion-col size="5">
20
       <ion-col size="5">
21
         <img src="../../assets/img-static/SEI129887404-c4a9.jpg">
21
         <img src="../../assets/img-static/SEI129887404-c4a9.jpg">
22
       </ion-col>
22
       </ion-col>
23
-      <ion-col class="ion-align-self-center">“น้องเทนนิส” หวังคว้าแชมป์ในศึกชิงแชมป์โลก ต้นเดือนหน้า</ion-col>
23
+      <ion-col class="ion-align-self-center"><a [routerLink]="['../news-detail/']">“น้องเทนนิส” หวังคว้าแชมป์ในศึกชิงแชมป์โลก ต้นเดือนหน้า</a></ion-col>
24
     </ion-row>
24
     </ion-row>
25
     <ion-row>
25
     <ion-row>
26
       <ion-col size="5">
26
       <ion-col size="5">

+ 16 - 0
src/app/services/wpdata.service.spec.ts

1
+import { TestBed } from '@angular/core/testing';
2
+
3
+import { WpdataService } from './wpdata.service';
4
+
5
+describe('WpdataService', () => {
6
+  let service: WpdataService;
7
+
8
+  beforeEach(() => {
9
+    TestBed.configureTestingModule({});
10
+    service = TestBed.inject(WpdataService);
11
+  });
12
+
13
+  it('should be created', () => {
14
+    expect(service).toBeTruthy();
15
+  });
16
+});

+ 10 - 0
src/app/services/wpdata.service.ts

1
+import { Injectable } from '@angular/core';
2
+import { HttpClient, HttpHeaders } from '@angular/common/http';
3
+
4
+@Injectable({
5
+  providedIn: 'root'
6
+})
7
+export class WpdataService {
8
+
9
+  constructor() { }
10
+}

Diferenças do arquivo suprimidas por serem muito extensas
+ 3245 - 0
src/assets/api/news-api.json