app.directive('ibaModel', function () {
return {
restrict: 'A',
priority: 1010,
scope: {
config:{
templateId:'='
}
},
link: function (scope, element, attrs) {
// debugger;
var el = $(element);
el.attr('id', scope.config.templateId);
el.iba_model('init', {id: scope.config.templateId});
}
};
});
var origObj = {
a: {
a_val1: {
a_val1_a: "some text"
},
a_val2: "text"
},
b: {
b_val1: {
b_val1_a: "one more",
b_val2_a: "one more2"
},
b_val2: "this is string"
}
}
var text = "one more2";
function search(obj, path) {
obj._path = path;
for (var key in obj) {
if (!obj.hasOwnProperty(key) || key === '_path') {
continue;
}
obj[key]._path = (obj._path + "." + key);
if (typeof obj[key] === "object") {
search(obj[key], obj[key]._path);
}
else if (obj[key] === text) {
console.log(text, " найден в объекте: " + obj._path + " , свойсво: " + key);
}
}
}
search(origObj, "origObj");
$.get('/get-html',function(data){
var $html = $(data);
})