Skip to content

Instantly share code, notes, and snippets.

@Frelseren
Created February 10, 2018 18:16
Show Gist options
  • Save Frelseren/778a95ce3152e79b1cff3c9ca5827d80 to your computer and use it in GitHub Desktop.
Save Frelseren/778a95ce3152e79b1cff3c9ca5827d80 to your computer and use it in GitHub Desktop.
Angular app REST
import { Component, OnInit } from '@angular/core';
import { ApexService } from '../apex.service';
interface Contact {
Id: string;
Name: string;
}
@Component({
selector: 'app-contacts',
templateUrl: './contacts.component.html'
})
export class ContactsComponent implements OnInit {
contacts: Contact[];
constructor(
private apex: ApexService
) {}
ngOnInit() {
this.apex.get().subscribe(
contacts => this.contacts = contacts,
error => console.log(error)
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment