如何获取 AngularJs 中元素的父元素的 ID

How to get the ID of the parent of an element in AngularJs

在下面的代码中:

   angular.element(element).parent()

如何获取家长的 ID?如果我这样做:

   console.log(angular.element(element).parent())

控制台显示如下:

使用.attr()/.prop()方法

angular.element(element).parent().attr('id')