2017-10-04 8 views
1
私はGoogleの画像のような画像を検索する展開したい

は、[拡大javascriptの画像]細かい作業のJavaScriptコードでjsfiddleのリンクである[1]なぜ画像グリッドはangularjs ng-repeatでは展開されませんが、javascriptはうまく機能しますか?

[1]: http://fiddle.jshell.net/XDaEk/638/ 

しかし、私はangularjs ngのリピートを使用して画像を拡大したいが、それはですあなたはimageexpander・ロジックを呼び出す前に、[2]

[2]: http://jsfiddle.net/36BYs/56/ 

答えて

1

[angularjs画像が拡大]、ここでjsfiddleのリンクコードをangularjsが動作していないあなたのngのリピートは、その要素を作るに行われていません。 ng-repeatのdom-nodeを呼び出す前に作成するのを待たなければなりません。

function MainCtrl($scope, $timeout) { 
    $scope.mydeom = [ 
       {image: 'http://www.jqueryscript.net/demo/Thumbnail-Grid-with-Expanding-Image-Preview-Using-jQuery/example/1.jpg',name:'Loren'}, 
       {image: 'http://www.jqueryscript.net/demo/Thumbnail-Grid-with-Expanding-Image-Preview-Using-jQuery/example/2.jpg',name:'Marry'} 
      ]; 

    $timeout(function() { 
     window.jQuery('.gallery-items').imagelistexpander({ 
      prefix: "gallery-" 
     }); 
    }) 
} 
関連する問題