Thursday, February 23, 2023

Angular Question

  • Type of Data Binding
    • One Way Binding
      • Interpolation Bnding
        • data move in one direction from components (typescript) to HTML
        • <p>{{ message }}</p> 
      • Property Binding
        • set properites to HTML elements.
        • [value]="user.email" or <img [src]="imageUrl"> 
    • Two Way Binding 
      • component and view are always in sync
      • Changes in user interface to model state.
      • Changes in model state reflect to user interface
      • <input [(ngModel)]="name">
  • Event Binding
    • One Way Binding
    • for event trigger
    • <button (click)="doSomething()">Click me</button> 


  • How does one share data between components in Angular? 
    • Parent to child using @Input decorator 

    • Child to parent using @ViewChild decorator 
    • Child to parent using @Output and EventEmitter 
  • Decorators
    • Design Pattern & function
    • modification to a class, service or filter
    • 4 Types
      • Class Decorators
      • Property Decorators
      • Method Decorators
      • Parameter Decorators
  • Advantages
    • MVC architecture
    • Modules
      • componentes
      • directives
      • pipe
      • services
    • Dependency Injection
      • component dependent on other components can easily worked around
    • Others
      • clean and maintainable code
      • reusable components
      • data binding
      • unit testing
  • Directives
    • attributes allow user write new HTML syntax
    • 3 Types
      • Component Directives
      • Structural Directives
      • Attribute Directives

    • myHighlist is Directives
  • Template
    • HTML View
    • seperate template file such **.html
  • Template Statements
    • properties or methods
    • (click)='addUser()"
    • addUser is template
  • Promises and Observables
    • Promises
      • emit single value at a time
      • Execute immediately after creation and not cancellable
      • Push Errors to child Promises
    • Observables
      • execute when subscribe()
      • emit Mutiple value over a period of time
      • perform forEach, filter and retry
      • Deliver errors to subscribers.
      • When unsubsribe() is called, listener stop receive further values.
  • ObservablePromise
    Declarative: Computation does not start until subscription so that they can be run whenever you need the resultExecute immediately on creation
    Provide multiple values over timeProvide only one
    Subscribe method is used for error handling which makes centralized and predictable error handlingPush errors to the child promises
    Provides chaining and subscription to handle complex applicationsUses only .then() clause
  • Difference AngularJS and Angular
  • AngularJSAngular
    It is based on MVC architectureThis is based on Service/Controller
    It uses JavaScript to build the applicationUses TypeScript to build the application
    Based on controllers conceptThis is a component based UI approach
    No support for mobile platformsFully supports mobile platforms
    Difficult to build SEO friendly applicationEase to build SEO friendly

No comments:

Post a Comment