Skip to content

Instantly share code, notes, and snippets.

@Frelseren
Created February 10, 2018 18:09
Show Gist options
  • Save Frelseren/ba6f30954e17ba4c3ef5e25dad229a58 to your computer and use it in GitHub Desktop.
Save Frelseren/ba6f30954e17ba4c3ef5e25dad229a58 to your computer and use it in GitHub Desktop.
Angular app Remote Action example
import { Component, OnInit } from '@angular/core';
declare const Visualforce;
interface Contact {
Id: string;
Name: string;
}
@Component({
selector: 'app-contacts',
templateUrl: './contacts.component.html'
})
export class ContactsComponent implements OnInit {
contacts: Contact[];
ngOnInit() {
Visualforce.remoting.Manager.invokeAction(
'AngularPOC.getContacts',
(result: Contact[], event) => {
if (event.status) {
this.contacts = result;
} else {
console.error(event.message);
}
},
{ escape: false }
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment