【发布时间】:2016-08-29 00:01:22
【问题描述】:
我在父控制器中有默认的 gridOptions。
EG:
$scope.gridOptions = {
rowHeight:50,
headerHeight:50,
onRegisterApi = function(gridApi,$scope){...}
}
实现 UI-Grids 的子控制器都继承了父 $scope,这似乎适用于原始类型的道具。
但是,在onRegisterApi 函数中,我需要能够访问不在父范围内的局部变量和方法。
我很确定我需要使用 JS 继承模式,但我很难让它发挥作用。我已经签出:http://blog.mgechev.com/2013/12/18/inheritance-services-controllers-in-angularjs/ 和https://www.exratione.com/2013/10/two-approaches-to-angularjs-controller-inheritance/
【问题讨论】:
标签: javascript angularjs inheritance angular-ui-grid