Skip to content

Instantly share code, notes, and snippets.

@anjianshi
Last active December 27, 2015 10:59
Show Gist options
  • Save anjianshi/7315688 to your computer and use it in GitHub Desktop.
Save anjianshi/7315688 to your computer and use it in GitHub Desktop.
ChildCtrl = function($scope) {
$scope.validate = function() {
//...
}
$scope.edit = function(item) {
parentValidateFn = $scope.$parent.validate;
$scope.$parent.validate = $scope.validate(); // 覆盖父类的方法
$scope.$parent.edit(item);
$scope.$parent.validate = parentValidateFn;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment