2

从安全角度来看,这两种访问本机元素的方法有什么区别吗?

SomeDirective implements OnInit{
  constructor(
    elementRef : ElementRef,
    renderer : Renderer2){}

 ngOnInit(){
  //method 1
  const el1 = this.elementRef.nativeElement;
  //method 2
  const el2 = this.renderer.GetRootElement(this.elementRef.nativeElement , true);
  //then use some method like this
  (el1 || el2).ScrollIntoView()
4

0 回答 0