KEMBAR78
Module 2.pptx Angular JS FRAMEWORK WEBDEVELOPMENT | PPTX
Angular
Module 2 - Introduction to Typescript
Learning Objectives
➔ What is Typescript?
➔ What is a Variable?
➔ Data Types
➔ Arrays
➔ Enum
➔ Function
➔ Classes in Typescript
➔ Inheritance
➔ Getter & Setter
➔ Interfaces
➔ Decorators
What is Typescript?
➔ Typescript is a superset of JavaScript.
➔ TypeScript is strongly typed, whereas JavaScript is dynamically typed.
➔ TypeScript allows to specify the datatype explicitly.
➔ Typescript helps the user to write the JavaScript more easier with advanced
features.
➔ TypeScript cannot be directly executed by browsers like JavaScript.
➔ Instead TypeScript code is compiled to get JavaScript code.
What is Typescript?
What is a Variable?
➔ Named storage to store a value
➔ In typescript, the variables are strongly typed
Datatypes
➔ String
◆ Use backticks ` mystring ` - used to write an expression
◆ Even we can use variables ${var} using backticks (Template reference syntax)
➔ Number
➔ Boolean
Arrays
Enum
Function
Function
Arrow Function
➔ Arrow functions have become the standard syntax in modern JavaScript.
➔ They offer a concise way to write functions, making your code lighter and
more readable
Class in Typescript
Class in Typescript
Class in Typescript
Class in Typescript
Method Overriding
Getter & Setter
➔ Getter will help the private
members to be accessed outside
the class.
➔ We use get keyword
➔ Setter will help us to set the
value of the private member
using set keyword.
Interface
➔ An interface in TypeScript
defines the expected
structure of an object.
➔ It provides a way to
describe the shape of
objects, including their
properties and methods,
without implementing any
functionality.
Why Interface?
➔ Improved Type Checking
➔ Easier to understand and
maintain the code.
➔ Interfaces can be extended and
reused across different parts of
the code.
Interface using Arrow functions
Multiple Inheritance
Decorators
➔ It is a powerful feature in
Typescript which helps to
add functionality or modify
the behavior of classes,
methods, properties and
parameters at runtime.
➔ They are functions declared
using @ symbol.
End of Module 2
Queries?

Module 2.pptx Angular JS FRAMEWORK WEBDEVELOPMENT

  • 1.
    Angular Module 2 -Introduction to Typescript
  • 2.
    Learning Objectives ➔ Whatis Typescript? ➔ What is a Variable? ➔ Data Types ➔ Arrays ➔ Enum ➔ Function ➔ Classes in Typescript ➔ Inheritance ➔ Getter & Setter ➔ Interfaces ➔ Decorators
  • 3.
    What is Typescript? ➔Typescript is a superset of JavaScript. ➔ TypeScript is strongly typed, whereas JavaScript is dynamically typed. ➔ TypeScript allows to specify the datatype explicitly. ➔ Typescript helps the user to write the JavaScript more easier with advanced features. ➔ TypeScript cannot be directly executed by browsers like JavaScript. ➔ Instead TypeScript code is compiled to get JavaScript code.
  • 4.
  • 5.
    What is aVariable? ➔ Named storage to store a value ➔ In typescript, the variables are strongly typed
  • 6.
    Datatypes ➔ String ◆ Usebackticks ` mystring ` - used to write an expression ◆ Even we can use variables ${var} using backticks (Template reference syntax) ➔ Number ➔ Boolean
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
    Arrow Function ➔ Arrowfunctions have become the standard syntax in modern JavaScript. ➔ They offer a concise way to write functions, making your code lighter and more readable
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
    Getter & Setter ➔Getter will help the private members to be accessed outside the class. ➔ We use get keyword ➔ Setter will help us to set the value of the private member using set keyword.
  • 18.
    Interface ➔ An interfacein TypeScript defines the expected structure of an object. ➔ It provides a way to describe the shape of objects, including their properties and methods, without implementing any functionality.
  • 19.
    Why Interface? ➔ ImprovedType Checking ➔ Easier to understand and maintain the code. ➔ Interfaces can be extended and reused across different parts of the code.
  • 20.
  • 21.
  • 22.
    Decorators ➔ It isa powerful feature in Typescript which helps to add functionality or modify the behavior of classes, methods, properties and parameters at runtime. ➔ They are functions declared using @ symbol.
  • 23.
    End of Module2 Queries?