This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
This gist is just an exploration of various types of scopes on a directive. I had mistakenly thought that | |
an isolate scope is a mechanism for selectively passing elements in the directive scope to the scope. So for example | |
if a parameter "p1" was defined in the outer scope of a directive, you could name it in the isolated scope and it | |
would be incorporated into the directive scope. However, this only applies to attributes that are on the directive itself | |
and not parameters that are in the scope at large. | |
If we use the "@", we are just bringing in the string assocaited with the attribute | |
If we use the "=", we are using the attribute value as a reference, and essentially evaluating it. This enables us | |
to watch that parameter for changes. It doesn't make any sense to "watch" a parameter that was brought in using "2" because it's value will never change - it's just a string |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let d1 = ["a":"foo","b":"bar"] | |
let d2 = ["c":"car","d":"door"] | |
let d3 = d1.reduce(d2) { (var d, p) in | |
d[p.0] = p.1 | |
return d | |
} | |
/* Result is ["b": "bar", "a": "foo", "d": "door", "c": "car"] */ |