我试图在里面有一个带有旋转木马的组件。
<ngb-carousel>
<template ngbSlide>
<img src="img1" alt="Random first slide">
<div class="carousel-caption">
<h3>First slide label</h3>
<p>Nulla vitae elit libero, a pharetra augue mollis interdum.</p>
</div>
</template>
<template ngbSlide>
<img src="img2" alt="Random second slide">
<div class="carousel-caption">
<h3>Second slide label</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
</div>
</template>
<template ngbSlide>
<img src="img3" alt="Random third slide">
<div class="carousel-caption">
<h3>Third slide label</h3>
<p>Praesent commodo cursus magna, vel scelerisque nisl consectetur.</p>
</div>
</template>
</ngb-carousel>
这是我的组件:
import {Component} from '@angular/core';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
@Component({
selector: 'img-carousel',
templateUrl: './img-carousel.component.html',
styleUrls: ['./img-carousel.component.scss']
})
export class ImgCarouselComponent {
}
这是module.ts:
import { NgModule } from '@angular/core';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { BookingComponent } from './booking.component';
import { ImgCarouselComponent } from './img-carousel/img-carousel.component';
@NgModule({
imports: [NgbModule.forRoot()],
exports: [BookingComponent],
declarations: [BookingComponent, ImgCarouselComponent],
providers: [],
})
export class BookingModule { }
问题是图像没有堆叠。我需要进口更多的东西,还是我错过了一些重要的东西?
角度版本:2.0.2 ng-bootstrap:@latest
我正在使用没有 system.js 的 Angular-cli。