Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


How would you control size of an element on resize of the window in a component?



How would you control size of an element on resize of the window in a component?..

Answer / Shikha Rai

To control the size of an element on window resize in Angular 2, you can use the following approach:
1. Import the EventListener from @angular/core and declare it as a property in your component class.
2. Add the EventListener to the window object's 'resize' event using the nativeWindow.addEventListener() method.
3. Inside the resize event handler, calculate the new size of the element based on the current window dimensions.
4. Update the element's style or properties with the calculated values.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More AngularJS Interview Questions

What does ng transclude do?

1 Answers  


What is the tslint.json file used for?

1 Answers  


How do you define a module?

1 Answers  


What is resolve in angularjs?

1 Answers  


What is routerstate in routers?

1 Answers  


What are the directives available in router?

1 Answers  


What is Data Binding? How Many Types Of Data Binding Directives Are Provided By AngularJS?

1 Answers  


Can I use angularjs with php?

1 Answers  


What is mvc application?

1 Answers  


How to use foreach in angular js?

1 Answers  


Explain the concept of lazy loading in angular 2

1 Answers  


What is ngrx?

1 Answers  


Categories