1

동일한보기에서 지시문을 두 번 호출하려고합니다. 내가 페이지를로드 할 때 다음과 같은 오류가 있습니다같은보기에있는 여러 개의 지시문이 작동하지 않습니다/Angularjs

ionic.bundle.js:21162Error: [$compile:multidir] Multiple directives [translate (module: pascalprecht.translate),mwConfirmClick] asking for new/isolated scope on: 

내 지시어 :

app.directive("mwConfirmClick", [ 
function() { 
    return { 
     priority: -1, 
     restrict: 'A', 
     scope: { confirmFunction: "&mwConfirmClick" }, 
     link: function(scope, element, attrs){ 
      element.bind('click', function(e){ 
       // message defaults to "Are you sure?" 
       var message = attrs.mwConfirmClickMessage ? attrs.mwConfirmClickMessage : "Are you sure?"; 
       // confirm() requires jQuery 
       if(confirm(message)) { 
        scope.confirmFunction(); 
       } 
      }); 
     } 
    } 
} 
]); 

당신이 내 지시를 설정하시기 바랍니다 도움이 있을까요? 같은 관점에서하지만 같은 요소뿐 아니라 분리 범위 (scope: {...}) 두 지시어를 사용하고 같은 사전

답변

0

에서

덕분에 보인다. 당신이 중 하나가 분리 범위와 지침 중 하나 (mw-confirm-click 또는 translate 지침)을 제거하거나 당신이 당신의 지침에서 분리 범위를 제거하고 변수를 사용할 필요가

<p mw-confirm-click="..." translate="..." ...></p> 

: 당신의 요소는 아마 다음과 같이 보입니다 부모 범위에서 ...

0

translate 지시문을 제거했는데 작동합니다. 감사합니다.

관련 문제