-
Notifications
You must be signed in to change notification settings - Fork 641
Closed
Labels
Description
When the data is loaded async the tabs will not update.
I've created an example overhere: http://plnkr.co/GFCCJ3XLB6FscPhrF7NW
(Also note clicking new, will reveal the second item)
angular.module('test', ['schemaForm']).controller('TestCtrl', function($scope, $q) {
function asyncLoad(data) {
var deferred = $q.defer();
setTimeout(function() {
deferred.resolve(data);
}, 0);
return deferred.promise;
}
var modelData = {
names: [{
name: 'me',
title: 'Me'
}, {
name: 'hi',
title: 'Hi'
}]
};
// without a promise the tabs are correct
// $scope.modelData = modelData;
// somehow the tabs are not loaded
asyncLoad(modelData).then(function(data) {
$scope.modelData = data;
});
$scope.schema = {
"type": "object",
"properties": {
"names": {
"type": "array",
"items": {
"type": "object",
"title": "subform",
"properties": {
"name": {
"type": "string"
},
"title": {
"type": "string"
}
}
}
}
}
};
$scope.form = [{
key: "names",
type: "tabarray",
'title': 'value.title || value.name || "Property " + ($index + 1)',
add: "New",
style: {
remove: "btn-danger"
},
}];
});