Skip to main content
spelling in title
Source Link
Cœur
  • 39k
  • 25
  • 206
  • 282

conditionnal conditional custom attribut directive in AngularJS

I have two custom directives (restrict : 'A') which are working well (custom1 and custom2)

In my html page I would like to use either custom1 attribut or custom2 attribut on a div depending on a condition. For example I would like to write something like this :

<div condition?custom1:custom2 />

I don't want to use ng-if like in the following code  :

<div id='main-div' ng-if="map.2d==true" custom1 />
<div id='main-div' ng-if="map.2d==false" custom2 />

Is there a way to write such a condition for attribut custom directives  ?

Thank you very much

conditionnal custom attribut directive in AngularJS

I have two custom directives (restrict : 'A') which are working well (custom1 and custom2)

In my html page I would like to use either custom1 attribut or custom2 attribut on a div depending on a condition. For example I would like to write something like this :

<div condition?custom1:custom2 />

I don't want to use ng-if like in the following code  :

<div id='main-div' ng-if="map.2d==true" custom1 />
<div id='main-div' ng-if="map.2d==false" custom2 />

Is there a way to write such a condition for attribut custom directives  ?

Thank you very much

conditional custom attribut directive in AngularJS

I have two custom directives (restrict : 'A') which are working well (custom1 and custom2)

In my html page I would like to use either custom1 attribut or custom2 attribut on a div depending on a condition. For example I would like to write something like this :

<div condition?custom1:custom2 />

I don't want to use ng-if like in the following code:

<div id='main-div' ng-if="map.2d==true" custom1 />
<div id='main-div' ng-if="map.2d==false" custom2 />

Is there a way to write such a condition for attribut custom directives?

Source Link
clement
  • 489
  • 1
  • 5
  • 19

conditionnal custom attribut directive in AngularJS

I have two custom directives (restrict : 'A') which are working well (custom1 and custom2)

In my html page I would like to use either custom1 attribut or custom2 attribut on a div depending on a condition. For example I would like to write something like this :

<div condition?custom1:custom2 />

I don't want to use ng-if like in the following code :

<div id='main-div' ng-if="map.2d==true" custom1 />
<div id='main-div' ng-if="map.2d==false" custom2 />

Is there a way to write such a condition for attribut custom directives ?

Thank you very much