2

I have the following code that I need to convert from jQuery to Angular.

$(this).append(elem)

I converted to the below and it seems to work:

angular.element(this).append(elem)

But isn't it this a jQuery element?

ps0604
  • 2,125
  • 16
  • 88
  • 233
  • Please check out [What is the difference between “this”, “$this” and “$(this)”?](http://stackoverflow.com/questions/3127429/how-does-the-this-keyword-work) – palaѕн Aug 14 '16 at 15:30
  • You're using [**jqLite**](https://docs.angularjs.org/api/ng/function/angular.element) library, so yes, it access `jQuery` behind. – developer033 Aug 14 '16 at 15:45
  • ^ This is not exactly true. It falls back to jQuery if the latter was loaded before Angular. Otherwise it uses jqLite, a partial implementation of jQuery API. – Estus Flask Aug 14 '16 at 15:48
  • The question *But isn't it this a jQuery element?* doesn't make much sense, because it is unknown what `this` is. – Estus Flask Aug 14 '16 at 15:51

0 Answers0