Skip to content

Commit

Permalink
enhance with
Browse files Browse the repository at this point in the history
  • Loading branch information
PitPik committed Sep 4, 2023
1 parent d6a6591 commit 4dfff37
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions circular.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,20 +361,21 @@ function setupInput(value, scope, doSubscribe, parent, inst, name) {
function applyModel(name, component, inst) {
var inst = inst.instance;
var names = name.split(/[./]/);
var data = findData(names, inst);
var models = findData(names, inst);
var data = models.data;
var childNodes = isArray(data) ? component.childNames[name] : null;
var vArray = getVArrayModel(name, component, inst, data, childNodes);

if (name === 'this' || !isArray(data))
return { model: vArray, standalone: true, id: inst['cr-id'] };

inst[name] = vArray;
models.parent[names[names.length - 1]] = vArray; // inst[name] = vArray;
return { model: vArray, id: vArray['cr-id'] };
}

function findData(names, data) {
for (var n = 0, l = names.length; n < l; n++) data = data[names[n]];
return data;
for (var n = 0, l = names.length; n < l; n++) { parent = data; data = data[names[n]]; }
return { parent: parent, data: data };
}

function getVArrayModel(name, component, inst, instData, childNodes) {
Expand Down
2 changes: 1 addition & 1 deletion circular.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion circular.min.js.map

Large diffs are not rendered by default.

0 comments on commit 4dfff37

Please sign in to comment.