1

我有一個自定義指令與一個獨立的作用域本身工作正常,但只有當我將該指令的屬性與'='運算符綁定時,因此當我將它們定義爲2路綁定。如果我嘗試將它們更改爲單向綁定('<'),則會出現此錯誤。 https://docs.angularjs.org/error/ $編譯/ ISCP P0 = xflWorkout & P1 =創建& P2 =%3C & P3 =分離%20scope%20definitionAngularJS指令只識別雙向綁定類型

這裏是我的指令的一個例子:

angular.module('directive.module', ['directive.dependency']) 
.directive('directiveName', function(){ 
    return { 
     restrict: 'E', 
     scope: { 
      'attr1': '=info', 
      'create': '<', 
      'attr3': '<', 
      'attr4': '=', 
      'attr5': '<' 
     }, 
     templateUrl: 'template.html', 
     replace: true, 
     controller: function($scope, $element, $attrs, $transclude, ...){ 
      //controller code`enter code here` 
     } 
}}); 

此外,我使用角1.4.2。

即使我的應用程序工作正常,我想知道爲什麼它的行爲如此謝謝任何幫助! :)

回答