如何在角度js

时间:2015-12-16 05:20:24

标签: jquery angularjs

我正在为DYO使用一个jquery插件(自己设计)。在该插件的js文件中,它已加载了一个模板文件,如下所示

 $.post(options.templatesDirectory + 'productdesigner.php',
        options.labels,
        function (html) {
            debugger;

            $elem.append($.parseHTML(html));

            $fullLoader = $elem.children('.fpd-full-loader').hide();
            $mainContainer = $elem.children('.fpd-main-container');
            $productStage = $mainContainer.children('.fpd-product-stage').height(options.stageHeight);

            $elementTooltip = $productStage.children('.fpd-element-tooltip').html(options.labels.outOfContainmentAlert);
            $mainContainer.children('.fpd-context-dialog').remove().clone().prependTo($sidePanel);
            $contextDialog = $body.find('.fpd-context-dialog').addClass('fpd-hidden');
            $contextLoader = $contextDialog.find('.fpd-context-loader');
            $colorPicker = $contextDialog.find('.fpd-color-picker');
            $colorPicker1 = $contextDialog.find('.fpd-color-pickerrr');
            $swatchPicker = $contextDialog.find('.fpd-color-swatch');

            $elem.trigger('templateLoad', [this.url]);
            setTimeout(_initBars, 1000);
        }
    );

我正在尝试将该插件集成到angularJS中。如何在此插件中加载此HTML文件。我只需要一个路径来在angularjs中加载这个HTML文件。我试过给路径,但总是返回404找不到错误。

1 个答案:

答案 0 :(得分:0)

我想到了我自己。我使用jquery load()方法在插件中加载了模板,如下所示。

$year_check = date('Y', strtotime($post->post_date));
            if($year_tmp!==$year_check){
                $year_tmp = $year_check;

                if($postsShown > 0){
                    echo '</div>';
                }

                echo '<div class="seperator"></div><a href="#" class="datecolumn" id="date_col_'.$year_check.'">'.$year_check.'<div class="expand" id="expand_'.$year_check.'">CLOSE</div></a><div class="seperator"></div><div class="ruler"></div><div class="seperator"></div><div class="yearBlock" id="'.$year_check.'">';
            }

            $date = date('jS F Y', strtotime($post->post_date));

            echo '<a class="standardColumnLink" href="'.get_permalink($post->ID).'" title="'.$thetitle.'">';

            if(!empty($thethumb)){
                echo '<div class="standardColumnImage">'.$thethumb.'</div>';
            }

            echo '<div class="columncopy"><div class="narrowcolumn">&rarr;</div><div class="titles">'.$thetitle.'</div><div class="columnbody">'.get_excerpt_by_id(get_the_ID()).'</div><div class="columdate"><strong>Date posted:</strong> '.$date.'</div></div></a>';

            if($year_tmp!==$year_check){
                echo '</div>';
            }