Skip to content

Instantly share code, notes, and snippets.

View Frelseren's full-sized avatar

Nikita Verkhoshintcev Frelseren

View GitHub Profile
@Frelseren
Frelseren / AngularPOC.cls
Created February 10, 2018 18:10
AngularPOC Apex class Web Service
global class AngularPOC {
@RemoteAction
webservice static String getContacts() {
return JSON.serialize([SELECT Id, Name FROM Contact]);
}
@RemoteAction
webservice static String getContact(String contactId) {
return JSON.serialize([SELECT Id, Name, Title, Phone, Email FROM Contact WHERE Id =: contactId][0]);
}
@Frelseren
Frelseren / contacts.component.ts
Created February 10, 2018 18:09
Angular app Remote Action example
import { Component, OnInit } from '@angular/core';
declare const Visualforce;
interface Contact {
Id: string;
Name: string;
}
@Component({
@Frelseren
Frelseren / AngularPOC.html
Created February 10, 2018 18:07
AngularPOC Visualforce page with RemoteAction
<apex:page standardStylesheets="false" sidebar="false" showHeader="false"
applyBodyTag="false" applyHtmlTag="false" docType="html-5.0"
controller="AngularPOC">
<html>
<head>
<meta charset="utf-8" />
<title>Meetup</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/x-icon" href="{!$Resource.AngularPOC + '/favicon.ico'}" />
@Frelseren
Frelseren / AngularPOC.page
Created February 10, 2018 18:06
AngularPOC Visualforce page with Remote Action
<apex:page standardStylesheets="false" sidebar="false" showHeader="false"
applyBodyTag="false" applyHtmlTag="false" docType="html-5.0"
controller="AngularPOC">
<html>
<head>
<meta charset="utf-8" />
<title>Meetup</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/x-icon" href="{!$Resource.AngularPOC + '/favicon.ico'}" />
@Frelseren
Frelseren / AngularPOC.cls
Created February 10, 2018 17:51
AngularPOC Apex class with Remote Action
public class AngularPOC {
@RemoteAction
public static List getContacts() {
return [SELECT Id, Name FROM Contact];
}
@RemoteAction
public static Contact getContact(String contactId) {
return [SELECT Id, Name, Title, Phone, Email FROM Contact WHERE Id =: contactId];
}