Use of symbols '@', '&', '=' and '>' in custom directive's scope binding: AngularJS

后端 未结 6 1684
北恋
北恋 2021-01-29 17:53

I have read a lot about the use of these symbols in the implementation of custom directives in AngularJS but the concept is still not clear to me.

What does it mean if I

6条回答
  •  醉话见心
    2021-01-29 18:16

    I had trouble binding a value with any of the symbols in AngularJS 1.6. I did not get any value at all, only undefined, even though I did it the exact same way as other bindings in the same file that did work.

    Problem was: my variable name had an underscore.

    This fails:

    bindings: { import_nr: '='}
    

    This works:

    bindings: { importnr: '='}
    

    (Not completely related to the original question, but that was one of the top search results when I looked, so hopefully this helps someone with the same problem.)

提交回复
热议问题