Search code examples
javascriptangularjsgridster

removing a widget from angular-gridster


I have a grid based on ng-repeat and an array:

$scope.standardItems = [
    { sizeX: 1, sizeY: 1, row: 0, col: 0, i: 0},
    { sizeX: 2, sizeY: 1, row: 0, col: 1, i: 1},
    { sizeX: 2, sizeY: 1, row: 0, col: 3, i: 2},
    { sizeX: 1, sizeY: 1, row: 1, col: 0, i: 3},
    { sizeX: 1, sizeY: 1, row: 1, col: 1, i: 4},
    { sizeX: 1, sizeY: 1, row: 1, col: 2, i: 5}
];

and

<div gridster="gridsterOpts">
    <ul>
        <li gridster-item="item" ng-repeat="item in standardItems track by item.i" >
            <div ng-if="$index === item.i && $index === 0" id="item_{{$index}}">

            ....
        </li>
    </ul>
</div>

I would like to remove one of the wdigets. I tried splicing the array, which resulted in a blank page. Help please?


Solution

  • Seems like angular-gridster doesn't support this without messing with the original file itself (like in this question) or accessing the DOM item itself, getting the gridster object and removing it via internal function.

    Not very "angular way", but that's what it is.