亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

angular2模塊和共享模塊詳解

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

創(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)文章

  • Angular?@Injectable注解的工作原理解析

    Angular?@Injectable注解的工作原理解析

    這篇文章主要為大家介紹了Angular?@Injectable注解的工作原理解析,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-06-06
  • Angular2  NgModule 模塊詳解

    Angular2 NgModule 模塊詳解

    這篇文章主要介紹了Angular2 NgModule 模塊詳解的相關(guān)資料,并附簡(jiǎn)單實(shí)例,需要的朋友可以參考下
    2016-10-10
  • 將angular-ui的分頁(yè)組件封裝成指令的方法詳解

    將angular-ui的分頁(yè)組件封裝成指令的方法詳解

    這篇文章主要給大家介紹了將angular-ui的分頁(yè)組件封裝成指令的方法,文中介紹的非常詳細(xì),相信會(huì)對(duì)大家的學(xué)習(xí)或者工作覺(jué)有一定的參考價(jià)值,需要的朋友下面來(lái)一起看看吧。
    2017-05-05
  • AngularJs bootstrap詳解及示例代碼

    AngularJs bootstrap詳解及示例代碼

    本文主要講解AngularJs bootstrap,這里整理了詳細(xì)的資料及簡(jiǎn)單示例代碼幫助大家學(xué)習(xí)或者參考,有需要的小伙伴看下
    2016-09-09
  • angular過(guò)濾器實(shí)現(xiàn)排序功能

    angular過(guò)濾器實(shí)現(xiàn)排序功能

    這篇文章主要為大家詳細(xì)介紹了angular過(guò)濾器實(shí)現(xiàn)排序功能,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2017-06-06
  • AngularJS控制器controller正確的通信的方法

    AngularJS控制器controller正確的通信的方法

    AngularJS中的controller是個(gè)函數(shù),用來(lái)向視圖的作用域($scope)添加額外的功能,我們用它來(lái)給作用域?qū)ο笤O(shè)置初始狀態(tài),并添加自定義行為
    2016-01-01
  • AngularJS的內(nèi)置過(guò)濾器詳解

    AngularJS的內(nèi)置過(guò)濾器詳解

    在我們開(kāi)發(fā)中經(jīng)常需要在頁(yè)面顯示給用戶的信息需要一定處理格式化,才能顯示給用戶。在angularjs中為我們提供了叫filter的指令,讓我們能夠很輕易就能做到著一些列的功能,angularjs內(nèi)部為我們提供了number等很多內(nèi)置的filter。
    2015-05-05
  • Angular4 組件通訊方法大全(推薦)

    Angular4 組件通訊方法大全(推薦)

    這篇文章主要介紹了Angular4 組件通訊方法大全(推薦),小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2018-07-07
  • AngularJS通過(guò)$sce輸出html的方法

    AngularJS通過(guò)$sce輸出html的方法

    不知道大家有沒(méi)有發(fā)現(xiàn)在用AngularJS作為前端搭建個(gè)人博客的時(shí)候,發(fā)現(xiàn)用AngularJs輸出html的時(shí)候,瀏覽器并不解析這些html標(biāo)簽,這里我們需要其顯示angular輸出的html能被瀏覽器解析怎么辦呢?不知道Angularjs如何實(shí)現(xiàn)這種功能的通過(guò)這篇文章來(lái)看看吧。
    2016-09-09
  • 詳解AngularJS Filter(過(guò)濾器)用法

    詳解AngularJS Filter(過(guò)濾器)用法

    這篇文章主要介紹了AngularJS的filter,中文名“過(guò)濾器”是用來(lái)過(guò)濾變量的值,或者格式化輸出,得到自己所期望的結(jié)果或格式的東東,的相關(guān)資料,需要的朋友可以參考下
    2015-12-12

最新評(píng)論