[英]what is the equivalent of $('#xxl') selector of jquery in angular.js
I have a code,that shows a modal with this code using jquery: 我有一个代码,使用jquery显示带有此代码的模态:
$('#myModal').modal({'show':true});
but with angular.js not works. 但是angular.js不起作用。 what is the equivalent of
$('#myModal')
using angular.js? 什么是使用angular.js的
$('#myModal')
等价物?
// not works for me
angular.element("#myModal")
您可以使用document.querySelector
获取dom元素,然后使用angular.element
var elem = angular.element(document.querySelector('#myModal'));
You can also try by injecting $document 您也可以尝试注入$ document
var elem = $document('#myModal');
In your case, you also do this little change to make your program run. 在你的情况下,你也做了这个小小的改动,让你的程序运行。
var elem = angular.element(document).find('#myModal');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.