ng-source和materializecss材料箱不起作用

时间:2016-01-13 06:30:18

标签: javascript jquery css angularjs materialize

我有一个flask个应用,我使用angularjs和前端的materializecss。在该应用程序中有一个库,我想在其中使用materialbox。如果图像是动态加载的,materialbox不会正确触发。

我发现这个问题here可能有重复,但不幸的是,这不起作用。

app.js

app.config(function($interpolateProvider, $routeProvider) {
        $interpolateProvider.startSymbol('{${');
        $interpolateProvider.endSymbol('}$}');

        $routeProvider

            // route for the home page
            .when('/', {
                templateUrl : 'pages/main_page.html',
                controller  : 'ListUrlController'
            })

            // route for the gallery page
            .when('/download/:threadUrl?', {
                templateUrl : 'pages/gallery_show.html',
                controller  : 'FormController'
            });

    });

showgallery.html 无效

<div class="row" ng-repeat="image_list in images" ng-show="ImageExists">
    <div class="col s12 m6 l3" ng-repeat="image in image_list">
        <img ng-src="{${ image.t_image }$}" class="responsive-img materialboxed" width="250">
    </div>
</div>
<script type="text/javascript">
    this.$('.materialboxed').materialbox();
</script>

有效(对图片网址进行硬编码)

<div class="row">
    <div class="col s12 m6 l3">
        <img src="http://img00.deviantart.net/ac7a/i/2014/279/d/f/lionel_messi_by_anaaospedacos-d800pg8.png" class="responsive-img materialboxed" width="250">
    </div>
    <div class="col s12 m6 l3">
        <img src="http://img00.deviantart.net/ac7a/i/2014/279/d/f/lionel_messi_by_anaaospedacos-d800pg8.png" class="responsive-img materialboxed" width="250">
    </div>
    <div class="col s12 m6 l3">
        <img src="http://img00.deviantart.net/ac7a/i/2014/279/d/f/lionel_messi_by_anaaospedacos-d800pg8.png" class="responsive-img materialboxed" width="250">
    </div>
    <div class="col s12 m6 l3">
        <img src="http://img00.deviantart.net/ac7a/i/2014/279/d/f/lionel_messi_by_anaaospedacos-d800pg8.png" class="responsive-img materialboxed" width="250">
    </div>
</div>
<script type="text/javascript">
    this.$('.materialboxed').materialbox();
</script>

但这也在控制台Uncaught TypeError: Cannot read property 'css' of undefined

中引发了一些异常

所以请告诉我我在这里失踪了什么。

0 个答案:

没有答案