Skip to content

Instantly share code, notes, and snippets.

@Frelseren
Created February 10, 2018 18:11
Show Gist options
  • Save Frelseren/afbbe98eb2c257096a14733cf460f6dc to your computer and use it in GitHub Desktop.
Save Frelseren/afbbe98eb2c257096a14733cf460f6dc to your computer and use it in GitHub Desktop.
Angular app Web Service
import { Component, OnInit } from '@angular/core';
declare const sforce;
interface Contact {
Id: string;
Name: string;
}
@Component({
selector: 'app-contacts',
templateUrl: './contacts.component.html'
})
export class ContactsComponent implements OnInit {
contacts: Contact[];
ngOnInit() {
try {
this.contacts = JSON.parse(sforce.apex.execute('AngularPOC', 'getContacts', { }));
} catch (e) {
console.error(e);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment