diff --git a/src/directives/table/table_view.coffee b/src/directives/table/table_view.coffee index e52b1fa..5b71475 100644 --- a/src/directives/table/table_view.coffee +++ b/src/directives/table/table_view.coffee @@ -17,7 +17,8 @@ angular.module("Mac").factory "MacTableController", ["Table", (Table) -> hasReorderableColumns: false makeTable: (columns) -> - @table = @scope.table = new Table columns + @table = @scope.table = new Table columns + @table.$parent = @scope.$parent ] angular.module("Mac").directive "macTable", [ "MacTableController", (MacTableController) -> diff --git a/test/unit/table_view.spec.coffee b/test/unit/table_view.spec.coffee index 803536a..c9a20f7 100644 --- a/test/unit/table_view.spec.coffee +++ b/test/unit/table_view.spec.coffee @@ -306,6 +306,10 @@ describe "Table View", -> it "Should set the width automatically", -> expect(element.find("[mac-cell-template]").first().attr("width")).toBe "50%" + describe "Scope References", -> + it "Stores the parent scope on the table object", -> + expect(element.scope().table.$parent).toBe scope + describe "Section Controllers", -> beforeEach inject (TableSectionController) ->