AngularJS - 动态更改图像的内容

时间:2015-02-04 08:31:40

标签: angularjs

我试图动态更改幻灯片的图片,更改src属性。代码确实执行,但在我的页面上没有显示任何内容而不是我的旧幻灯片。 src属性设置正确但未显示错误。

这是我的HTML:

<div id="catalogue">
    <div class="lineaCatalogo" ng-repeat="linea in lineas">
      <img ng-src="{{linea.image}}" alt="">
      <h3 ng-click="getLinea(linea)">{{linea.title}}</h3>
      <p>{{linea.description}}</p>
    </div>
  </div>

  <div class="productPartial" ng-repeat="linea in lineas | filter: {title: selected_linea_title}">

    <div id="banner-fade1">
      <ul class="bjqs">
        <li ng-repeat="producto in linea.productos" id="{{producto.title}}"><img src="{{producto.image}}" title="{{producto.description}}"></li>
      </ul>
    </div>

    <div class="datosProducto" ng-repeat="producto in linea.productos | filter: {title: 'Producto 2'}">
      <h2 class="tituloProducto">{{producto.title}}</h2>

      <p class="descripcionProducto">{{producto.description}}</p>
    </div>

  </div>

和JS代码:

$scope.selected_linea_title = 'Linea 3';
    $scope.selected_linea;
    $scope.selectedProduct = 'Producto 1';
    $scope.getLinea = function(linea){
        $filter
        $scope.selected_linea_title = linea.title;
        $scope.selected_linea = linea;
    }

getLinea()获取一个哈希对象并选择我点击#catalogue

的哈希对象

数据:

$scope.lineas = [
    {
        title: 'Linea 1',
        description: 'Descripcion 1',
        image: 'img/linea3-3-g.jpg',
        productos: [
        {
            title: 'Producto 1',
            description: 'The description of the first product. It is not important to see the quality, just the maximum length we can show at the end.',
            image: 'img/linea1.jpg'
        },
        {
            title: 'Producto 2',
            description: 'The description of the second product. It is not important to see the quality, just the maximum length we can show at the end.',
            image: 'img/linea1.jpg'
        },
        {
            title: 'Producto 3',
            description: 'The description of the third product. It is not important to see the quality, just the maximum length we can show at the end.',
            image: 'img/linea1.jpg'
        }
        ]
    },
编辑:我发现了下一个错误:

file:/// C:/Users/Jose/Raul/webUM/%7B%7Bproducto.image%7D%7D无法加载资源:net :: ERR_FILE_NOT_FOUND

为什么不接受{{}}符号??

0 个答案:

没有答案