Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/401.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
为什么图像网格不在angularjs ng repeat中扩展,但javascript工作正常?_Javascript_Jquery_Angularjs_Angularjs Ng Repeat - Fatal编程技术网

为什么图像网格不在angularjs ng repeat中扩展,但javascript工作正常?

为什么图像网格不在angularjs ng repeat中扩展,但javascript工作正常?,javascript,jquery,angularjs,angularjs-ng-repeat,Javascript,Jquery,Angularjs,Angularjs Ng Repeat,我想像google images一样扩展图像搜索这里是JSFIDLE与javascript代码的链接它工作正常[javascript图像扩展][1] [1]: http://fiddle.jshell.net/XDaEk/638/ 但我想使用angularjs ng repeat扩展图像,但它不起作用,这里是JSFIDLE angularjs代码的链接[angularjs image expand][2] [2]: http://jsfiddle.net/36BYs/56/ 在调用im

我想像google images一样扩展图像搜索这里是JSFIDLE与javascript代码的链接它工作正常[javascript图像扩展][1]

  [1]: http://fiddle.jshell.net/XDaEk/638/
但我想使用angularjs ng repeat扩展图像,但它不起作用,这里是JSFIDLE angularjs代码的链接[angularjs image expand][2]

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

在调用imageexpander逻辑之前,ng repeat未完成其元素的生成。在调用它之前,必须等待创建ng repeat的dom节点

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-"
        });
    })
}