From 616b4025fe4ed21002e38e63d77dedfd76972eca Mon Sep 17 00:00:00 2001 From: Paul Bailey Date: Thu, 14 May 2015 21:59:37 +0000 Subject: [PATCH] fixed layout undefined --- angular-deckgrid.js | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/angular-deckgrid.js b/angular-deckgrid.js index e57bda8..71ca7e4 100644 --- a/angular-deckgrid.js +++ b/angular-deckgrid.js @@ -363,16 +363,18 @@ angular.module('akoenig.deckgrid').factory('Deckgrid', [ var self = this, layout = this.$$getLayout(); - // - // Okay, the layout has changed. - // Creating a new column structure is not avoidable. - // - if (layout.columns !== this.$$scope.layout.columns) { - self.$$scope.layout = layout; - - self.$$scope.$apply(function onApply () { - self.$$createColumns(); - }); + if (layout !== undefined) { + // + // Okay, the layout has changed. + // Creating a new column structure is not avoidable. + // + if (layout.columns !== this.$$scope.layout.columns) { + self.$$scope.layout = layout; + + self.$$scope.$apply(function onApply () { + self.$$createColumns(); + }); + } } };