I am working with a Node
object in my Angular controller. Each Node
contains a next
property which points to the next item:
$scope.Stack = function () {
this.top = null;
this.rear = null;
this.size = 0;
this.max_size = 15;
};
$scope.Node = function (data) {
this.data = data;
this.next = null;
this.previous = null;
};
$scope.Stack.prototype.pushUp = function (data) {
for (i = 0; i < data.items.length; i++) {
if (data.items[i]) {
var node = new $scope.Node(data.items[i]);
if (node) {
node.previous = this.top;
if (this.top) {
this.top.next = node;
}
this.top = node;
// if first push, then set the rear
if (this.size == 0) {
this.rear = node;
}
this.size += 1;
}
}
}
};
Initializing an object:
$scope.Timeline = new $scope.Stack();
My query: Can ng-repeat/Angular be used to iterate over linked data structures like this?