Your solution works great except when getting data from the service using Ajax calls.
I modified MainCtrl to fetch the data from the server using http call and everything else is same but it doesn't work. Is it due to timing?
app.controller('MainCtrl', function ($scope, widgetFactory) {
//$scope.widgets = [
// { ContainerRow: "1", ContainerColumn: "1", ContainerSizex: "1", ContainerSizey: "1", Title: "Widget 1" },
// { ContainerRow: "1", ContainerColumn: "2", ContainerSizex: "1", ContainerSizey: "1", Title: "Widget 2" }
//]
$scope.widgets = [];
var successCallBack = function (data, status) {
$scope.widgets = data;
};
var errorCallback = function (data, status, headers, config) {
alert("error");
};
widgetFactory.getWidgets().success(successCallBack).error(errorCallback);
});