Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

angular window object

// in app.module.ts
providers: [
{ provide: Window, useValue: window }
]

// in component: 
Then you can just inject it directly anywhere you want - e.g. in a service:

constructor(private window: Window) {
// ...
Source by www.leonelngande.com #
 
PREVIOUS NEXT
Tagged: #angular #window #object
ADD COMMENT
Topic
Name
6+9 =