Skip to content
Angular

@angular/core, @angular/common/http, @angular/router API Reference

Angular core APIs — the @Component decorator and lifecycle, HttpClient for HTTP, and the Router for navigation.

By EZ4Code Team

Component

The @Component decorator and related APIs for defining components, inputs/outputs, and lifecycle hooks.

@Component(metadata)

Decorator that marks a class as an Angular component and attaches metadata (selector, template, styles).

Returns: ComponentDecorator

@Input() property

Marks a class property as a data-bound input from a parent component's template.

Returns: InputDecorator

@Output() event = new EventEmitter<T>()

Marks a property as an output that a parent component can bind to with event binding.

Returns: OutputDecorator

ngOnInit()

Lifecycle hook called once after Angular initializes the data-bound properties of a directive.

Returns: void

ngOnDestroy()

Lifecycle hook called once before Angular destroys the directive. Use for cleanup.

Returns: void

HttpClient

Angular's HttpClient for performing HTTP requests. Methods return cold observables.

http.get<T>(url, options?)

Performs an HTTP GET request, emitting the response body.

Returns: Observable<T>

http.post<T>(url, body, options?)

Performs an HTTP POST request with a request body.

Returns: Observable<T>

http.put<T>(url, body, options?)

Performs an HTTP PUT request to replace a resource.

Returns: Observable<T>

http.delete<T>(url, options?)

Performs an HTTP DELETE request.

Returns: Observable<T>

Router

Angular Router service for navigating between views and inspecting route state.

router.navigate(commands, extras?)

Navigates based on an array of URL segments with optional navigation extras.

Returns: Promise<boolean>

router.navigateByUrl(url)

Navigates using an absolute URL path string.

Returns: Promise<boolean>

route.snapshot.paramMap.get(key)

Reads a route parameter synchronously from the activated route's snapshot.

Returns: string | null

router.events

An observable of router events (NavigationStart, NavigationEnd, etc.).

Returns: Observable<Event>

More Angular API References