0

I have two custom directives; namely directiveA and directiveB. Both are custom directives performing two different actions

<input type="text"
       name="order_value"
       data-ng-model=""
       directive-a="{{formatText}}"
       directive-b="{{test}}"/> 

But when I use both directives, the element is not shown. If I use only one of the directives it's working properly.

My console is displaying the following error.

Error: error:multidir Multiple Directive Resource Contention

What should I do to be able to use both my directives on the same element?

Patrick
  • 17,669
  • 6
  • 70
  • 85
user2324085
  • 63
  • 1
  • 3
  • 11

2 Answers2

0

From the docs:

Description

This error occurs when multiple directives are applied to the same DOM element, and processing them would result in a collision or an unsupported configuration.

To resolve this issue remove one of the directives which is causing the collision.

Example scenarios of multiple incompatible directives applied to the same element include:

Multiple directives requesting isolated scope.

Multiple directives publishing a controller under the same name.

Multiple directives declared with the transclusion option.

Multiple directives attempting to define a template or templateURL.

Following this post you could also try to remove replace: true from your directives.

Community
  • 1
  • 1
DonJuwe
  • 4,477
  • 3
  • 34
  • 59
-1

After a long try, I have found the Simple Solution for the above issue.

if u have scope set to true ie.,scope: true in the directive, Set to false scope: false

user2324085
  • 63
  • 1
  • 3
  • 11