Angle2 모듈 및 공유 모듈에 대한 자세한 설명

亚连
풀어 주다: 2018-05-26 13:55:55
원래의
1328명이 탐색했습니다.

이 글에서는 주로 Angular2 모듈과 공유 모듈에 대한 자세한 설명을 소개하고 참고하겠습니다.

모듈을 생성하려면 공유 모듈인 PostSharedModule이 사용됩니다. 공유 모듈에는 기사 관리 모듈과 댓글 관리 모듈

1 모듈 testmodule.module.ts

import { CommonModule } from '@angular/common'; 
import { NgModule } from '@angular/core'; 
import { RouterModule } from "@angular/router"; 
import { <span style="color:#cc0000;"><strong>PostSharedModule </strong></span>} from &#39;../shared/post.module&#39;; 
import { testModule } from &#39;./testmodule.routes&#39;; 
import { TestMainComponent } from &#39;./test-main/test-main.component&#39;; 
import { PostTableService } from &#39;../manage/post-table/services/post-table.service&#39;; 
@NgModule({ 
 declarations: [ 
  TestMainComponent 
 ], 
 imports: [ 
   CommonModule, 
   <span style="color:#ff0000;">PostSharedModule</span>, 
   RouterModule.forChild(testModule) 
 ], 
 exports:[ 
  TestMainComponent 
 ], 
 providers: [ 
  PostTableService 
 ] 
}) 
export class TestModule { }
로그인 후 복사

2이 포함되어 있습니다. 모듈 경로 testmodule.routes.ts

import { TestMainComponent } from &#39;./test-main/test-main.component&#39;; 
import { PostTableComponent } from &#39;../manage/post-table/post-table.component&#39;; 
import { CommentTableComponent } from &#39;../manage/comment-table/comment-table.component&#39;; 
export const testModule = [ 
  { 
    path:&#39;&#39;, 
    component:TestMainComponent, 
    children: [ 
      { path: &#39;&#39;,redirectTo:&#39;posttable/page/1&#39;,pathMatch:&#39;full&#39;}, 
      { path: &#39;posttable/page/:page&#39;, component: PostTableComponent }, 
      { path: &#39;commenttable/page/:page&#39;, component: CommentTableComponent }, 
      { path: &#39;**&#39;, redirectTo:&#39;posttable/page/1&#39; } 
    ] 
  } 
];
로그인 후 복사

3을 생성하고, test-main 컴포넌트를 생성하고, test-main.comComponent.html

<a routerLink="posttable/page/1" class="list-group-item"><span class="badge">10000</span>文章管理</a> 
    <a routerLink="commenttable/page/1" class="list-group-item"><span class="badge">1000000</span>评论管理</a>
로그인 후 복사

수정 모듈 포스트를 생성합니다. .module.ts

import { NgModule } from &#39;@angular/core&#39;; 
import { ModalModule } from &#39;ng2-bootstrap&#39;; 
import { PaginationModule } from &#39;ng2-bootstrap&#39;; 
import { SharedModule } from &#39;./shared.module&#39;; 
import { CommentTableComponent } from &#39;../manage/comment-table/comment-table.component&#39;; 
import { PostTableComponent } from &#39;../manage/post-table/post-table.component&#39;; 
@NgModule({ 
 imports:[  
  SharedModule, 
  ModalModule.forRoot(), 
  PaginationModule.forRoot() 
 ], 
 declarations:[  
  CommentTableComponent,  
  PostTableComponent 
 ], 
 exports:[  
  ModalModule, 
  PaginationModule, 
  CommentTableComponent,  
  PostTableComponent 
 ] 
}) 
export class PostSharedModule { 
  
}
로그인 후 복사

위 내용은 제가 모든 사람을 위해 정리한 내용입니다. 앞으로 모든 사람에게 도움이 되기를 바랍니다.

관련 기사:

Ajax 크로스 도메인(동일한 기본 도메인 이름) 양식 제출 방법

AJAX 제출 양식 데이터 예시 분석

Ajax 관련 및 장점과 단점에 대한 간략한 토론

위 내용은 Angle2 모듈 및 공유 모듈에 대한 자세한 설명의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

관련 라벨:
원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
최신 이슈
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!