import {Component, ViewContainerRef} from '@angular/core' //noinspection TypeScriptCheckImport import { elementVisible, computedStyle, scrollTo, outerHeight, outerWidth } from 'ng2-utils'; @Component({ selector: 'my-app', template: ` #hello
DOM functions
elementVisible Test
elementVisible('#hello', 'body'): {{elementVisible('#hello', 'body') | json}}
computedStyle Test
computedStyle('#hello', 'height'): {{computedStyle('#hello', 'height') | json}}
scrollTo Test
scrollTo('#hello', 'body'): {{scrollToResult}}
outerHeight/outerWidth Test
outerHeight('#hello'): {{outerHeight('#hello')}}
outerWidth('#hello'): {{outerWidth('#hello')}}
Pipes
HtmlCodePipe: htmlCode myHtml: {{myHtml}}
myHtml | htmlCode:
{{myHtml | htmlCode}}
myHtml | htmlCode:'include' :
{{myHtml | htmlCode:'include'}}
myHtml | htmlCode:'ng2-utils-11' :
{{myHtml | htmlCode:'ng2-utils-11'}}
myHtml | htmlCode:'-include'
{{myHtml | htmlCode:'-include'}}
JavascriptCodePipe: jsCode ngOnInit | jsCode:
{{ngOnInit | jsCode}}
Directives 1 2 3 4 5
` }) export class AppComponent { el: HTMLElement; resp: any = {}; elementVisible: any = elementVisible; computedStyle: any = computedStyle; outerHeight: any = outerHeight; outerWidth: any = outerWidth; myHtml = ` I ng2-utils-11 E `; scrollToResult: boolean; ngOnInit() { scrollTo('#hello', 'body'); this.scrollToResult = true; } }