AngularJS の Directive / Component では、コントローラーにデータをバインディングする際に @
, =
, &
, <
を指定することができます。(1.5現在) 双方向データバインディングである =
ではオプションとして、=?
、=*
を指定することができますが、=*
の使い方、使い道がいまいち理解できていません。
ドキュメント(https://docs.angularjs.org/api/ng/service/$compile) によると、
By default, the $watch method is used for tracking changes, and the equality check is based on object identity. However, if an object literal or an array literal is passed as the binding expression, the equality check is done by value (using the angular.equals function). It's also possible to watch the evaluated value shallowly with $watchCollection: use =* or =attr (=? or =*?attr if the attribute is optional).
とあり、通常は $watch
によって、参照の変更を監視しているが、=*
の利用で、$watchCollection
による shallow watch に変化するとあります。
配列オブジェクトを渡す場合は、同じオブジェクトになると思うので、とくに =
での実装で今のところ困ったことはありませんが、ドキュメントに書いてあり、$compile 中で、=*
の動作が定義されている以上気になります。
実際の実装例などがありましたら、添えていただけると助かります。
追記:
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。