Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/31.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Twitter bootstrap 角度2引导转盘作为背景_Twitter Bootstrap_Angular - Fatal编程技术网

Twitter bootstrap 角度2引导转盘作为背景

Twitter bootstrap 角度2引导转盘作为背景,twitter-bootstrap,angular,Twitter Bootstrap,Angular,试着做旋转木马,并把图片作为背景,希望有人能帮助我,为我的蹩脚英语道歉:) 下面是我键入的代码: 第一个角度: import { Component, OnInit } from '@angular/core'; import { NgStyle } from '@angular/common'; import { NgFor } from '@angular/common'; @Component({ selector: 'app-slider', templateUrl: './s

试着做旋转木马,并把图片作为背景,希望有人能帮助我,为我的蹩脚英语道歉:) 下面是我键入的代码: 第一个角度:

import { Component, OnInit } from '@angular/core';
import { NgStyle } from '@angular/common';
import { NgFor } from '@angular/common';

@Component({
  selector: 'app-slider',
  templateUrl: './slider.component.html',
  styleUrls: ['./slider.component.css']
})
export class SliderComponent implements OnInit {

  constructor() { }

  images = [];

  ngOnInit() {
    this.images = [
  {"id":1, "url":"assets/img/header.jpeg"},
  {"id":2, "url":"assets/img/velo2.jpeg"},
  {"id":3, "url":"assets/img/velo3.jpeg"},
    ]
  }
}
和我的html代码:

<carousel >
  <slide *ngFor = "let image of images" >
    <div [ngStyle]="{'background-image': url(' + image.url + ')}"></div>
  </slide>

</carousel>

什么不起作用?我有很多错误:我没有把img作为背景:TypeError:_co.url不是一个函数你应该把它们包括在问题中。好的,它完成了。)我很直截了当地想,
错误TypeError:_co.url不是一个函数
。您是否包含了所有需要的库?
ERROR TypeError: _co.url is not a function
at Object.eval [as updateDirectives] (ng:///AppModule/SliderComponent.ngfactory.js:17)
at Object.debugUpdateDirectives [as updateDirectives] (vendor.bundle.js:82907)
at checkAndUpdateView (vendor.bundle.js:82087)
at callViewAction (vendor.bundle.js:82452)
at execEmbeddedViewsAction (vendor.bundle.js:82410)
at checkAndUpdateView (vendor.bundle.js:82088)
at callViewAction (vendor.bundle.js:82452)
at execComponentViewsAction (vendor.bundle.js:82384)
at checkAndUpdateView (vendor.bundle.js:82093)
at callViewAction (vendor.bundle.js:82452)