Which is equivalent to the $ ('# xxl') jquery selector in angular.js

I have code that shows modal code using jquery:

$('#myModal').modal({'show':true});

but does not work with angular.js. what is equivalent $('#myModal')using angular.js?

// not works for me
angular.element("#myModal")
+4
source share
2 answers

You can use document.querySelectorto get the dom element and then useangular.element

var elem = angular.element(document.querySelector('#myModal'));
+4
source

You can also try by typing $ document

var elem = $document('#myModal');

In your case, you will also make this small change to run your program.

var elem = angular.element(document).find('#myModal');
0
source

Source: https://habr.com/ru/post/1694119/


All Articles