0

I am using an angular library which is written using the {{ }} delimiters. For some reason I had to change the delimiters for my project (let's say I'm using [[ ]])

The problem is that the library's directives are written using the regular delimiters {{ }} and are therefore NOT interpolated the right way anymore.

Is there a way to write a directive able to interpolate the arguments whatever the current delimiter ?

Flavien Volken
  • 19,196
  • 12
  • 100
  • 133
  • best guess is you won't be able to switch since you would have had to made your changes in angular config. – charlietfl Dec 06 '14 at 18:27
  • 1
    Have you considered using the "ng-bind" directive in place of {{ }} in your html code? can be used almost everywhere {{foo}} can be used. – Prahlad Yeri Dec 06 '14 at 18:44
  • @PrahladYeri the [directive I'm using](https://github.com/driftyco/ionic/blob/master/js/angular/directive/item.js) is interpolating attribute using the `{{` `}}`notation. If ng-bind works for the content itself, is there something for the attributes ? By writing this I do realise they might simply change their template using dynamically fetched delimiters. – Flavien Volken Dec 07 '14 at 05:41

1 Answers1

1

If ng-bind works for the content itself, is there something for the attributes ?

Use the ng-bind: class attribute value template syntax. For example:

<div class="ng-bind: expression;"> ... </div>

Directive declaration styles have four variations:

E - Element name (default): <my-directive></my-directive>
A - Attribute (default): <div my-directive="exp"></div>
C - Class: <div class="my-directive: exp;"></div>
M - Comment: <!-- directive: my-directive exp -->

References

Paul Sweatte
  • 24,148
  • 7
  • 127
  • 265
  • Not precisely what I was looking for, but okay cause it can also works in some cases. I found [this post](http://stackoverflow.com/questions/12923521/angular-js-custom-delimiter) which helps in getting the current "startSymbol" and "endSymbol" and can then be used for forging the right "handlebars". – Flavien Volken Jul 23 '15 at 19:08