最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

angular2模塊和共享模塊詳解

 更新時間:2018年04月08日 08:38:54   作者:孟繁洋  
這篇文章主要介紹了angular2模塊和共享模塊詳解,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧

創(chuàng)建模塊,用到了共享模塊PostSharedModule,共享模塊里面包含了2個公用的模塊:文章管理模塊和評論管理模塊

1,創(chuàng)建一個模塊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 '../shared/post.module'; 
import { testModule } from './testmodule.routes'; 
import { TestMainComponent } from './test-main/test-main.component'; 
import { PostTableService } from '../manage/post-table/services/post-table.service'; 
@NgModule({ 
 declarations: [ 
  TestMainComponent 
 ], 
 imports: [ 
   CommonModule, 
   <span style="color:#ff0000;">PostSharedModule</span>, 
   RouterModule.forChild(testModule) 
 ], 
 exports:[ 
  TestMainComponent 
 ], 
 providers: [ 
  PostTableService 
 ] 
}) 
export class TestModule { } 

2.創(chuàng)建模塊路由testmodule.routes.ts

import { TestMainComponent } from './test-main/test-main.component'; 
import { PostTableComponent } from '../manage/post-table/post-table.component'; 
import { CommentTableComponent } from '../manage/comment-table/comment-table.component'; 
export const testModule = [ 
  { 
    path:'', 
    component:TestMainComponent, 
    children: [ 
      { path: '',redirectTo:'posttable/page/1',pathMatch:'full'}, 
      { path: 'posttable/page/:page', component: PostTableComponent }, 
      { path: 'commenttable/page/:page', component: CommentTableComponent }, 
      { path: '**', redirectTo:'posttable/page/1' } 
    ] 
  } 
]; 

3.執(zhí)行ng g c test-main,創(chuàng)建組件test-main,修改test-main.component.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>

創(chuàng)建 共享模塊post.module.ts 

import { NgModule } from '@angular/core'; 
import { ModalModule } from 'ng2-bootstrap'; 
import { PaginationModule } from 'ng2-bootstrap'; 
import { SharedModule } from './shared.module'; 
import { CommentTableComponent } from '../manage/comment-table/comment-table.component'; 
import { PostTableComponent } from '../manage/post-table/post-table.component'; 
@NgModule({ 
 imports:[  
  SharedModule, 
  ModalModule.forRoot(), 
  PaginationModule.forRoot() 
 ], 
 declarations:[  
  CommentTableComponent,  
  PostTableComponent 
 ], 
 exports:[  
  ModalModule, 
  PaginationModule, 
  CommentTableComponent,  
  PostTableComponent 
 ] 
}) 
export class PostSharedModule { 
  
} 

以上就是本文的全部內(nèi)容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。

相關文章

  • 實例剖析AngularJS框架中數(shù)據(jù)的雙向綁定運用

    實例剖析AngularJS框架中數(shù)據(jù)的雙向綁定運用

    這篇文章主要介紹了AngularJS框架中數(shù)據(jù)的雙向綁定運用實例,包括數(shù)據(jù)綁定中的關鍵函數(shù)與監(jiān)聽器觸發(fā)的相關講解,需要的朋友可以參考下
    2016-03-03
  • angularjs 的數(shù)據(jù)綁定實現(xiàn)原理

    angularjs 的數(shù)據(jù)綁定實現(xiàn)原理

    本篇文章主要介紹了angularjs 的數(shù)據(jù)綁定實現(xiàn)原理,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2018-07-07
  • 淺談Angular 中何時取消訂閱

    淺談Angular 中何時取消訂閱

    本篇文章主要介紹了淺談Angular 中何時取消訂閱,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2017-11-11
  • AngularJS基礎 ng-non-bindable 指令詳細介紹

    AngularJS基礎 ng-non-bindable 指令詳細介紹

    本文主要講解AngularJS ng-non-bindable 指令,這里幫大家整理了ng-non-bindable指令的基本知識資料,有需要的小伙伴可以參考下
    2016-08-08
  • Angular整合zTree的示例代碼

    Angular整合zTree的示例代碼

    本篇文章主要介紹了Angular整合zTree的示例代碼,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2018-01-01
  • AngularJS中取消對HTML片段轉(zhuǎn)義的方法例子

    AngularJS中取消對HTML片段轉(zhuǎn)義的方法例子

    這篇文章主要介紹了AngularJS中取消對HTML片段轉(zhuǎn)義的方法例子,在一些需要顯示HTML的地方,就要取消AngularJS的轉(zhuǎn)義,本文就介紹了這種方法,需要的朋友可以參考下
    2015-01-01
  • angularJS的radio實現(xiàn)單項二選一的使用方法

    angularJS的radio實現(xiàn)單項二選一的使用方法

    下面小編就為大家分享一篇angularJS的radio實現(xiàn)單項二選一的使用方法,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2018-02-02
  • 詳解創(chuàng)建自定義的Angular Schematics

    詳解創(chuàng)建自定義的Angular Schematics

    本文對 Angular Schematics 進行了介紹,并創(chuàng)建了一個用于創(chuàng)建自定義 Component 的 Schematics ,然后在 Angular 項目中以它為模板演練了通過 Schematics 添加自定義的 Component,感興趣的小伙伴們可以參考一下
    2018-06-06
  • 小談angular ng deploy的實現(xiàn)

    小談angular ng deploy的實現(xiàn)

    這篇文章主要介紹了小談angular ng deploy的實現(xiàn),文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
    2020-04-04
  • Angular應用打包和部署實現(xiàn)過程詳解

    Angular應用打包和部署實現(xiàn)過程詳解

    這篇文章主要為大家介紹了Angular應用打包和部署實現(xiàn)過程詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪
    2023-08-08

最新評論

淮滨县| 平邑县| 龙岩市| 栖霞市| 涟源市| 蓬安县| 宝应县| 星子县| 农安县| 莒南县| 盐山县| 新竹市| 鸡泽县| 长宁区| 台山市| 武强县| 师宗县| 新沂市| 揭阳市| 祁门县| 岳阳县| 长垣县| 兴和县| 昌都县| 新巴尔虎左旗| 博湖县| 海口市| 静乐县| 泰和县| 原平市| 涞源县| 兴隆县| 义乌市| 玛沁县| 昭觉县| 莲花县| 环江| 泰安市| 化德县| 江津市| 汶川县|