angularjs - " =? " in Angular Directive Isolate Scope -


scope: {     someproperty: "=?"     somepropertytwo: =?wheeeeee } 

what "=?" do? can't find answer anywhere. understand using scope: {} (or scope: true) gives directive new scope, former being isolate scope , latter being one-way binded parent ctrl (ctrl of page/view on directive used). understand that:

someprop: @x //will one-way bind someprop parent ctrl's x someprop: =x //two-way someprop: &x() //some space magic binding methods 

however, don't understand how/why " =? " used.

relevant articles (that cover first three): http://www.undefinednull.com/2014/02/11/mastering-the-scope-of-a-directive-in-angularjs/ http://weblogs.asp.net/dwahlin/creating-custom-angularjs-directives-part-2-isolate-scope

edit: same these?

? - attempt locate required controller or pass null link fn if not found. ^ - locate required controller searching element , parents. throw error if not found. https://docs.angularjs.org/api/ng/service/$compile#-require-

i.e. null passed if whatever property isn't found?

it means two-way binding optional. if define property using = must provide valid binding. $compile documentation:

(...) if parent scope property doesn't exist, throw non_assignable_model_expression exception. can avoid behavior using =? or =?attr in order flag property optional. if want shallow watch changes (i.e. $watchcollection instead of $watch) can use =* or =attr (=? or =*?attr if property optional).


Popular posts from this blog