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

angular2模塊和共享模塊詳解

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

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

1,創(chuàng)建一個(gè)模塊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>評(píng)論管理</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 { 
  
} 

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

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

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

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

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

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

    淺談Angular 中何時(shí)取消訂閱

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

    AngularJS基礎(chǔ) ng-non-bindable 指令詳細(xì)介紹

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

    Angular整合zTree的示例代碼

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

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

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

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

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

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

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

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

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

    Angular應(yīng)用打包和部署實(shí)現(xiàn)過程詳解

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

最新評(píng)論

京山县| 绿春县| 邛崃市| 宁强县| 松溪县| 中山市| 西乌| 海宁市| 富民县| 太保市| 都江堰市| 芜湖市| 六安市| 会昌县| 四子王旗| 乌鲁木齐县| 六枝特区| 锦屏县| 闵行区| 无极县| 报价| 饶平县| 蚌埠市| 房山区| 常山县| 财经| 桑植县| 贡山| 和林格尔县| 利津县| 沙雅县| 射阳县| 台北县| 正蓝旗| 嘉兴市| 无为县| 双牌县| 白城市| 云和县| 天等县| 青州市|