简体   繁体   中英

How can I simulate resize in Angular?

How can I simulate resize in Angular without jquery?

Before, I did it like:

$(window).resize();

And second questions about focus() When I try to focus element:

angular.element(document.querySelector('.kb-active')).focus();

Console log: Error: angular.element(...).focus is not a function

Thanks!

Angular ships with jqLite. If you need jQuery you need to assure that jQuery is loaded before angular. Than angular uses jQuery.

For reference the jqLite documentation is here: https://code.angularjs.org/1.2.28/docs/api/ng/function/angular.element

Which states that .focus() is not supported. If you load jQuery you can use .focus() and .resize() .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM