Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Angularjs to Angular Migration: factory prototype

abstract class AbsCard {

  abstract remoteId: number;
  abstract version: number;
  abstract name: string
  abstract stars: number;

  public initFromRemote(): void {
    this.remoteId = 0;
  }

  public print() {
    console.log(this);
  }

}

class Card extends AbsCard {

  public remoteId: number = 0;
  version: number = 0;
  name: string = '';
  stars: number = 0;
  
  public constructor() { 
    super();
    /* other creation logic can come here */
  }
}

let c = new Card();
c.print();
 
PREVIOUS NEXT
Tagged: #Angularjs #Angular #factory #prototype
ADD COMMENT
Topic
Name
4+7 =