DEV Community

Abhishek Chaudhary
Abhishek Chaudhary

Posted on

3

Most important Angular Interview Question :

What are Angular services, and how do you use them?
Answer: Angular services are singleton objects that encapsulate business logic and data sharing across components. They’re created with the @Injectable decorator and provided via dependency injection.

Explain the difference between ngOnInit() and a constructor in Angular.
Answer: The constructor is for initializing class members, while ngOnInit() is a lifecycle hook where you should fetch data or run code once the component’s view is ready.

How does Angular handle two-way data binding?
Answer: Angular uses the [(ngModel)] directive for two-way data binding, syncing the model and view by combining property binding and event binding.

What is lazy loading in Angular, and why is it useful?
Answer: Lazy loading loads feature modules only when they’re needed, reducing initial load time and improving performance.

Explain the difference between @Input() and @Output() decorators.
Answer: @Input() allows passing data from a parent to a child component, while @Output() emits events from a child to a parent component.

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (0)

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay