Get me outta here!

Friday, May 17, 2024

Angular Basics

Intro

    package.json

     (list of dependencies)

    package-lock.json

     (details list of that dependencies)

    angular.json

     (map everything here: assets, scripts etc)

    tsconfig.json

     (typescript configuration file)

    polyfills.ts

     (compatibility file)

 

Components

    Modules must be declared in the imports

    Components must be declared in the declarations

    Standalone components are not dependent in any modules and it must be declared in imports

    and Pipes are doing the transformation over text


Bindings - Two Way, Property, Event


Routing

    Basic Routing

      Routes for mapping path & component

      routerLink navigate to different routes

      router-outlet for displaying matched route

    Child routing

     Activated Route (const routeId = route.snapshot.paramMap.get(id);)

    Module Routing

     const routes : Routes

    Lazy Loading

     Load when required (loadChildren then import)


Directives

    Add additional behavior to elements

    Components works as a directive

    Attribute Directive

ngClass (Binding Classes)

ngStyle (Binding Styles, Only accept objects s = {})

ngModel (Two Way Binding)

    Structural Directive

*ngIf

*ngFor

*ngSwitch


Services

    Defined with @Injectable

    All are in observable format and without subscribe it wont work (Rxjs feature)


FormType

    TDF handle in html file

     ngForm

    Reactive handle in ts file

     FormGroup


Guard

    used to control access in particular route

    canActivate

    canActivateChild

    canDeactivate

    canLoad


Interceptor

    Used for token login

    Declares in app.module [Providers]


Rxjs

    Observable and Operators

    Promise (then, then, finally)    

0 comments:

Post a Comment