本文整理汇总了TypeScript中@angular/core.Renderer.invokeElementMethod方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Renderer.invokeElementMethod方法的具体用法?TypeScript Renderer.invokeElementMethod怎么用?TypeScript Renderer.invokeElementMethod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@angular/core.Renderer
的用法示例。
在下文中一共展示了Renderer.invokeElementMethod方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: onBlur
onBlur($event) {
this.renderer.invokeElementMethod(this.elRef.nativeElement,
'dispatchEvent', [new CustomEvent('input-blur', {bubbles: true})]);
// or just
// el.dispatchEvent(new CustomEvent('input-blur', { bubbles: true }));
// if you don't care about webworker compatibility
}
示例2: ngAfterViewInit
public ngAfterViewInit():void {
var inputs = this.element.nativeElement.getElementsByTagName('input');
if (inputs.length > 0) {
var firstInput = inputs[0];
this.renderer.invokeElementMethod(firstInput, 'focus', []);
}
}
示例3: ngAfterViewInit
ngAfterViewInit() {
this.renderer.invokeElementMethod(this.input.el.nativeElement,'focus', null );
this.inputs.forEach((inputDir:InputDir,i)=>{
inputDir.el.nativeElement.value = i;
})
console.log('Focus on the Input');
}
示例4: onMouseEnter
onMouseEnter()
{
if (this._isactive)
{
this._highlight("red");
let validationMessage = '<div id="' + this._key + '">' + this._validationMessage + '</div>';
this.renderer.invokeElementMethod(
this._nativeel, 'insertAdjacentHTML', ['afterend', validationMessage]);
//this._nativeel.insertAdjacentText('afterend',validationMessage);
}
}
示例5: ngAfterViewInit
ngAfterViewInit(): void {
this.positionPopover();
this.cdr.detectChanges();
let focusButton: ElementRef;
if (this.options.focusButton === 'confirm') {
focusButton = this.confirmButton;
} else if (this.options.focusButton === 'cancel') {
focusButton = this.cancelButton;
}
if (focusButton) {
this.renderer.invokeElementMethod(focusButton.nativeElement, 'focus', []);
}
}
示例6: ngAfterViewInit
// Focus to element: if value 0 = don't set focus, 1 = set only focus, 2 = set focus and set cursor position
ngAfterViewInit() {
// if (this.value === "0") {
// return;
// }
this.renderer.invokeElementMethod(this.el.nativeElement, 'focus', []);
// // Set cursor position at the end of text if input element
// if (this.value === "2") {
// let len = this.el.nativeElement.value.length;
// this.el.nativeElement.setSelectionRange(len, len);
// }
}
示例7:
.then((cmpRef: any) => {
if (dialog.inElement) {
this._renderer.invokeElementMethod(
viewContainer.element.nativeElement,
'appendChild',
[cmpRef.hostView.rootNodes[0]]
);
} else {
document.body.appendChild(cmpRef.hostView.rootNodes[0]);
}
dialog.destroy = () => cmpRef.destroy();
return dialog;
});
示例8: ngAfterViewInit
// Focus to element: if value 0 = don't set focus, 1 = set only focus
ngAfterViewInit() {
if (this.value === "0") {
return;
}
this.renderer.invokeElementMethod(this.el.nativeElement, "focus", []);
}
示例9: ngAfterViewInit
ngAfterViewInit() {
if (this.elementRef.nativeElement.querySelector('#password') != null) {
this.renderer.invokeElementMethod(this.elementRef.nativeElement.querySelector('#password'), 'focus', []);
}
}
示例10: setFocus
setFocus() {
if(this.focus && this.oElement) {
this.oRenderer.invokeElementMethod(this.oElement.nativeElement, 'select', []);
this.oRenderer.invokeElementMethod(this.oElement.nativeElement, 'focus', []);
}
}