Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

creating a class in angular

$ ng generate class class_name
Comment

create class angular

// to create a model class, we first need to create a new file
//f.e person.ts

export class Person {
 constructor(
  public name: string,
   public lastName: string,
   public age:number
  
  ) {}
}

//now that we have the model class we can create arrays that contain Person class elements

.
.
public people: Person[];
constructor(){
 this.people = [
   new Person ('Carla','Smith', 20 ),
    new Person ('Carlos','Smith', 25 ),
    new Person ('Andrea','Johnson', 23 ),
   
   ];
}


Comment

PREVIOUS NEXT
Code Example
Javascript :: how to append the dropdown values by jquery each function 
Javascript :: react navigation header background color 
Javascript :: decode morse code js 
Javascript :: convert node.js to ES6 
Javascript :: how to get items in dynamodb nodejs 
Javascript :: how to take input in javascript in coding 
Javascript :: javascript xor 
Javascript :: lodash remove element from list 
Javascript :: jquery find selected option by class 
Javascript :: check if string contains substring javascript 
Javascript :: nodejs check if string matches regex 
Javascript :: moment time ago format reactjs 
Javascript :: error vuejs from chokidar enospc 
Javascript :: How do I redirect to another webpage 
Javascript :: windows how to set process.env variables 
Javascript :: jquery select all checkboxes 
Javascript :: foreach object javascript 
Javascript :: javascript absolute path 
Javascript :: jquery remove option from select 
Javascript :: jquery edit iframe content 
Javascript :: print page in javascript 
Javascript :: Nullish Coalescing Vs Logical OR opreators 
Javascript :: get number of days between two dates mongodb query 
Javascript :: set data-id javascript 
Javascript :: react native tab.screen hide title 
Javascript :: ngx toastr 
Javascript :: jquery ajax responsetext 
Javascript :: javascript loop over dictionary 
Javascript :: flatlist horizontal 
Javascript :: nodejs await inside map 
ADD CONTENT
Topic
Content
Source link
Name
9+4 =