Guest User

Untitled

a guest
Oct 21st, 2018
282
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     import { Component, OnInit, Input } from "@angular/core";
  2.     import { FirstClass } from "~/shared/firstclass.model";
  3.     import { SecondClass } from "~/shared/secondclass.model";
  4.     import { DataService } from "~/shared/data.service";
  5.  
  6.     @Component({
  7.         selector: "test-component",
  8.         moduleId: module.id,
  9.         templateUrl: "./test.component.html",
  10.         styleUrls: ['./test.component.css']
  11.     })
  12.     export class TestComponent implements OnInit {
  13.  
  14.         tickettypes: TicketType[];
  15.  
  16.         @Input("first")
  17.         public get first() {
  18.             return this._first;
  19.         };
  20.         public set first(value: FirstClass) {
  21.             this._first = value;
  22.         }
  23.         private _first: FirstClass;
  24.  
  25.         @Input("second")
  26.         public get second() {
  27.             return this._second;
  28.         };
  29.         public set second(value: SecondClass) {
  30.             this._second = value;
  31.         }
  32.         private _second: SecondClass;
  33.  
  34.         constructor(
  35.             private dataService: DataService
  36.         ) {
  37.             // Use the component constructor to inject providers.
  38.         }
  39.  
  40.         ngOnInit(): void {
  41.            
  42.         }
  43.  
  44.         itemTap(tickettype: TicketType) {
  45.             let item = new SecondClass( {
  46.                 foo: "bar"
  47.             });
  48.             this.dataService.addItem(item);
  49.         }
  50.  
  51.     }
Advertisement
Add Comment
Please, Sign In to add comment