Typescript Variable Declaration in Angular
We can declare the different type of variable in angular it supports following type of data.
  
   
- Introduction
- Boolean
- Number
- String
- Array
- Tuple
- Enum
- Any
- Void
- Null and Undefined
- Never
- Object
- Complete Program of Angular JS typescript
import { Component, OnInit } from '@angular/core';
@Component({
  selector: 'app-sharukh',
  templateUrl: './sharukh.component.html',
  styleUrls: ['./sharukh.component.css']
})
export class SharukhComponent implements OnInit {
   a:number=10;
   b:number=20;
   c:number=0;
   s:string
   s1:string 
   b1:boolean
   //arr:number[];
   arr:Array<number>[];
  constructor() {
    this.c=this.a+this.b
    this.s= "hello"
    this.s= 'hi'
    this.s1 = `${ this.s } ram is going to market`
    this.arr = [11,23,34,56,67]
    this.b1=false;
    //this.tpl=['rno',1001];
  }
  ngOnInit() {
  }
}
html code

 
 
 
 
0 تعليقات
POST Answer of Questions and ASK to Doubt