Skip to content

Instantly share code, notes, and snippets.

@nathanwoulfe
Created April 3, 2023 08:48
Show Gist options
  • Save nathanwoulfe/30f25259bd978bcd7e27dc76d8818859 to your computer and use it in GitHub Desktop.
Save nathanwoulfe/30f25259bd978bcd7e27dc76d8818859 to your computer and use it in GitHub Desktop.
Get ancestor scope in AngularJs
  getEditorScope = $scope => {
    let editorScope = $scope.$parent;
    do {
      editorScope = editorScope.$parent;
    } while (!Object.prototype.hasOwnProperty.call(editorScope, 'contentForm'));
    this.editorScope = editorScope;
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment