Skip to content

Instantly share code, notes, and snippets.

@anjianshi
Last active December 27, 2015 10:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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