1

For developers who used to the JQuery for many years, we used to get the html element always.

I find it very tricky in angularjs,
I'm looking for an equivalent of $(selector). I'll give you an example where I need the HTML element.
I'm using select2 as my dropdown when i need to set the defualt value I need to run the following code:

$("#id").select2('data', { id: id, text: text });

because select2 angularjs wrapper is not binding properly.
Or if anyone can help with maybe a different way of thinking.

Basil
  • 1,613
  • 12
  • 25

1 Answers1

1

Operating with HTML elements directly with Angular is not an optimal way and is bound to cause issues.

If you are using select2 with Angular you might want to take a look at the following NPM package that works as a wrapper for select2 with Angular. https://www.npmjs.com/package/ng2-select2

Omkar Khair
  • 1,364
  • 2
  • 17
  • 40
  • select2 was just an example and why i don't wat to go with the angularjs library because i have done huge modifications on select2 to work the best with my projects so i'll need a huge efforts to redo it again. – Basil Dec 29 '19 at 09:20