Contents tagged with Class creation

  • TypeScript class creation

    Hello everybody,

    today I want to document some demos for class declaration in Angular 2. 

    So, let's say you have following class declared:

    Snippet

    import { Component, Injectable } from '@angular/core'

    import { Http, Response } from '@angular/http'

    @Component({

    })

    export class Config {

        public apiKey: string = 'xxxxxyy117c24d8b9085187163f5d241';

        public url: string = 'https://public-api.blablacar.com/api/v2/trips?key=';

        constructor(private http: Http) {

        }

        getReqUrl(): string{

            return this.url + this.apiKey;

        }

    }

    Then the way to create it is the following:

    Snippet

    findTrips()

    {

        let conf = new Config();

        let url: string  … more