Angular2 retrieve all elements with class name

后端 未结 5 1753
[愿得一人]
[愿得一人] 2020-12-16 09:55

Can anyone help with how to find \'All\' Elements with a particular class name in Angular 2? I thought it would be trivial but it\'s giving me more problems that was prepar

5条回答
  •  误落风尘
    2020-12-16 10:41

    This might be a little over-simplistic for your use case, but is there any reason you can't use the native DOM functions, like so?

    var domRepresentation = document.getElementsByClassName('classImLookingFor');
    var angularElement = angular.element(domRepresentation);
    

提交回复
热议问题