Tuesday 16 May 2017

NG2- How to add Javascript in Angular 2

NG2- How to add Javascript in Angular 2
--------------------------------------------------

We shouldn't directly include script in index.html

Solution-1 - Angular CLI- solution
-----------
Open Angular-cli.json 

add under script{ ""ScriptName": "JS file  path located in our application" }

Solution-2 - Other Ng application
-----------

Open the package.json 

add under script{ "ScriptName" :"Script npm path - name" }

Wednesday 3 May 2017

NG2- Screen height and Width measure even resize of the screen Height

NG2- Screen height and Width measure even resize of the screen Height
====================================================

screenHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);

onResize(event) {
  event.target.innerWidth;
  this.screenHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
   
}

Ref: http://stackoverflow.com/questions/35527456/angular2-window-resize-event