Search code examples
angularjsangularjs-scopeangular-directive

Directive = and @ combo


I have my directive used at differennt pages :-

For example(prototype) :-

<my-directive title="{{title}}"></my-directive>

in this case I can get value in scope

scope:{
 title:"="
}

But in some places the data is static with same directive defination:-

<my-directive title="Hello"></my-directive>

Now same directive is not getting title :-(

Is there a way I can use "=" even with normal string.


Solution

  • use quotes '' as,

    <my-directive title="'Hello'"></my-directive>