2017-03-25 7 views
0

非同期コンテンツの読み込みと1.6:AngularJS jQueryのステップ(プラグイン)私は<a href="http://www.jquery-steps.com/Examples#async" rel="nofollow noreferrer">jQuery Steps</a>プラグインを使用して動的に非同期でHTMLコンテンツをロードした後という問題を抱えている

<section data-mode="async" data-url="test.html"></section> 

AngularJSは、コンテンツので、すべての要素を検出しません期待どおりに非表示にする代わりに、ng-showディレクティブが含まれています。 編集 - - 問題と

Punkler解決(Punkler更新)

http://plnkr.co/edit/6p1dVln2R9Pgb9ivoMcX?p=preview

PS:私はロードする必要がHTMLデータの量があるので、私は非同期に負荷を必要とします過剰。

+0

AngularまたはjQueryを使用してください。 jQueryを完全に削除してください。それが解決策です。 –

+0

jQueryを削除する必要はありませんが、テンプレートがロードされた後にangleが実行されていることを確認する必要があるため、非同期ロードの角度を使用する必要があります。ここでは、ディレクティブを使用して非同期的にテンプレートを読み込むソリューションを提案する記事があります。 http://stackoverflow.com/questions/21196245/load-angular-directive-template-async –

答えて

1

あなたはangularjs

<section ng-include="'test.html'"></section> 

で動的なテンプレートのロードにng-includeを使用する必要があると私はそれ見える

作業Plunker

+0

ロードする必要があるHTMLデータが過剰です。どのようにウィザードの次のボタンを使用してオンデマンドでロードするのですか?コントローラーの中に何を入れる必要がありますか? – Slowaways

0

が解決を参照してくださいにするためにtest.htmlからng-showを削除した - (Punkler更新日)

私は onloadng-includeを使用

http://plnkr.co/edit/6p1dVln2R9Pgb9ivoMcX?p=preview

ng-if
<!-- Jquery Steps HTML Template --> 
<div id="wizard" ng-controller="wizardCtrl"> 
    <h3><i class="fa fa-question-circle" aria-hidden="true"></i> Arroz</h3> 
    <section> 
    <div ng-if="index == '1'" ng-include="'test.html'" onload="finishLoading()"></div> 
    </section> 
</div> 

<script> 
    // Jquery Steps Plugin 
    $wizard = $("#wizard"); 
    $wizard.steps({ 
    headerTag: "h3", 
    bodyTag: "section", 

    enableFinishButton: false, 
    enablePagination: true, 
    enableAllSteps: false, 
    forceMoveForward: true, 
    titleTemplate: "#title#", 
    cssClass: "wizard tabcontrol", 

    labels: { 
     loading: "" 
    } 
    }); 

    angular.module('myApp', []) 
    .controller('wizardCtrl', ['$scope', '$timeout', function($scope, $timeout){ 
     $scope.index = "1"; 

     $scope.finishLoading = function(){ 
      // jQuery Steps 
      var index = $wizard.steps("getCurrentIndex"); 
      // ... 

      return true; 
     }; 
    }]); 
</script> 

、あなたはオンデマンドのタブのコンテンツをロードすることができ、つまり、あなたは現在を取得するためにgetCurrentIndexと呼ばれるjQueryのステップメソッドを使用することができますステップインデックス。 autoloadを使用して< Steps Methods>

は非同期コンテンツ負荷のonContentLoadedメソッドをオーバーライドします。 < Steps Events>

関連する問題

 関連する問題