I followed some tutorials to create angular directives. In the isolate scope, some tutorials define scope like this:
scope: {
model: '=?',
data: '@?'
}
Meanwhile, some tutorials define scope without question mark like this:
scope: {
model: '=',
data: '@'
}
Can anybody explain me the difference or the purpose of these with examples? Thank you.
Should is used to say that something is the proper or best thing to do, or to say that someone ought to do something or must do something. Adam could visit us on Monday. This tells us that it is possible Adam will visit on Monday, maybe he can visit us, but maybe he has other options, too.
We use when to mean '(at) the time that'. We use since to refer to a particular time in the past until another time or until now: I had a great time when I went to the coast.
It was a time when people didn't have to lock their doors. the happy days when we were together We're still waiting for the test results, when we'll decide our next move. Conjunction When he finally showed up, he was drunk. When I was in school, we didn't have computers.
That in that is why is usually the subject of a sentence or a clause that can stand alone: I want to be involved in town government, and that is why I'm running for mayor. My mother always gives me good advice, so that is why I need to ask her opinion.
The &
, @
, and =
symbols are used to define the bindings (one-way, bi-directional, etc) for isolated scope objects, as you already know. Here is a pretty thorough tutorial on how all this works.
The ?
symbol is used to indicate that the parent scope property to which the isolated scope binding refers to is optional. This means that if for some reason the parent scope property doesn't exist, then your application will continue to run without throwing the NON_ASSIGNABLE_MODEL_EXPRESSION exception.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With