|
@@ -39,18 +39,20 @@ function Seed (el, data, options) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// process nodes for directives
|
|
// process nodes for directives
|
|
|
|
|
+ // first, child with sd-each directive
|
|
|
|
|
+
|
|
|
this._compileNode(el, true)
|
|
this._compileNode(el, true)
|
|
|
|
|
|
|
|
- // copy in methods from controller
|
|
|
|
|
- if (controller) {
|
|
|
|
|
- controller.call(null, this.scope, this)
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
// initialize all variables by invoking setters
|
|
// initialize all variables by invoking setters
|
|
|
for (key in dataCopy) {
|
|
for (key in dataCopy) {
|
|
|
this.scope[key] = dataCopy[key]
|
|
this.scope[key] = dataCopy[key]
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // copy in methods from controller
|
|
|
|
|
+ if (controller) {
|
|
|
|
|
+ controller.call(null, this.scope, this)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
Seed.prototype._compileNode = function (node, root) {
|
|
Seed.prototype._compileNode = function (node, root) {
|
|
@@ -110,15 +112,15 @@ Seed.prototype._bind = function (node, bindingInstance) {
|
|
|
var key = bindingInstance.key,
|
|
var key = bindingInstance.key,
|
|
|
epr = this._options.eachPrefixRE,
|
|
epr = this._options.eachPrefixRE,
|
|
|
isEachKey = epr && epr.test(key),
|
|
isEachKey = epr && epr.test(key),
|
|
|
- seed = this
|
|
|
|
|
|
|
+ scopeOwner = this
|
|
|
// TODO make scope chain work on nested controllers
|
|
// TODO make scope chain work on nested controllers
|
|
|
if (isEachKey) {
|
|
if (isEachKey) {
|
|
|
key = key.replace(epr, '')
|
|
key = key.replace(epr, '')
|
|
|
} else if (epr) {
|
|
} else if (epr) {
|
|
|
- seed = this._options.parentSeed
|
|
|
|
|
|
|
+ scopeOwner = this._options.parentSeed
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- var binding = seed._bindings[key] || seed._createBinding(key)
|
|
|
|
|
|
|
+ var binding = scopeOwner._bindings[key] || scopeOwner._createBinding(key)
|
|
|
|
|
|
|
|
// add directive to this binding
|
|
// add directive to this binding
|
|
|
binding.instances.push(bindingInstance)
|
|
binding.instances.push(bindingInstance)
|