angularjs directive 中 scope '=?' 表达的是什么意思?

angularjs directive 中 scope '=?' 表达的是什么意思?

阅读 4.1k
2 个回答

If the parent scope property doesn't exist, it will throw a NON_ASSIGNABLE_MODEL_EXPRESSION exception. You can avoid this behavior using =? or =?attr in order to flag the property as optional.


If you want to shallow watch for changes (i.e. $watchCollection instead of $watch) you can use =* or =*attr (=*? or =*?attr if the property is optional).

双向的数据绑定,你可以看看这里传送门

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
宣传栏