2016-07-17 3 views
0

私は角度が新しく、mmenuを使ってディレクティブを作成しようとしましたが、残念ながらプラグインは機能しません。 助けがあれば助かります。ディレクティブでmmenuを実行する

私はplunkerを作成しました。

は、私がmmenuについて多くを知らないが、あなたのplunkerに基づいて、最も明白な問題はrestrict: 'A'の使用で、

var App = angular.module('wdapp', []); 

App.controller('results', function($scope, $http) { 
$http.get('data.json') 
    .then(function(res){ 
     $scope.bookmarks = res.data;     
    }); 
}); 

App.directive("mmenu", function() 
    { 
     return { 
      restrict: "A", 
      link: function(scope, element, attrs){ 
       $(element).mmenu({ 
        offCanvas: false, 
        //counters: true, 
        searchfield: { 
         add: false, 
         //search: false, 
        }, 
        header: { 
         add: true, 
         update: true, 
         title: "Navigation" 
        }, 
        navbar: { 
         title: "" 
        }, 

       }); 
      } 
     }; 
    }); 

答えて

0

、ありがとうございました。これは属性のディレクティブです。

あなたが要素ディレクティブとしてそれを使用するためにrestrict: 'E'またはrestrict: 'EA'にこれを更新する必要があります。あなたも同様である。<mmenu></mmenu>

restrict財産上の

詳細情報:AngularJS: API: $compile

関連する問題