This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, OnInit, ChangeDetectorRef } from '@angular/core'; | |
import * as LCC from 'lightning-container'; | |
declare const sforce; | |
interface Contact { | |
Id: string; | |
Name: string; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<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="favicon.ico"> | |
<link rel="stylesheet" href="assets/main.css"> | |
</head> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<aura:component implements="flexipage:availableForAllPageTypes" access="global"> | |
<lightning:container src="{!$Resource.AngularPOC + '/index.html'}" /> | |
</aura:component> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, OnInit } from '@angular/core'; | |
import { ApexService } from '../apex.service'; | |
interface Contact { | |
Id: string; | |
Name: string; | |
} | |
@Component({ | |
selector: 'app-contacts', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// apex.service.ts | |
import { Injectable } from '@angular/core'; | |
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http'; | |
import { Observable } from 'rxjs/Observable'; | |
declare const sessionId; | |
interface Contact { | |
Id: string; | |
Name: string; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<apex:page standardStylesheets="false" sidebar="false" showHeader="false" | |
applyBodyTag="false" applyHtmlTag="false" docType="html-5.0"> | |
<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'}" /> | |
<link rel="stylesheet" type="text/css" href="{!$Resource.AngularPOC + '/assets/main.css'}" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RestResource(urlMapping = '/angularpoc') | |
global class AngularPOC { | |
@HttpGet | |
global static List<Contact> getContacts() { | |
RestRequest req = RestContext.request; | |
String contactId = req.params.get('contactId'); | |
if (contactId != null) { | |
return [SELECT Id, Name, Title, Phone, Email FROM Contact WHERE Id =: contactId]; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Example of asynchronous web service | |
// Function that returns a promise with a list of contacts | |
// and throws if there is any error in Apex. As alternative, | |
// you can return empty array right there. | |
async getContacts(): Promise<Contact[]> { | |
try { | |
const contacts = await JSON.parse(sforce.apex.execute('AngularPOC', 'getContacts', { })); | |
return contacts; | |
} catch (e) { | |
throw new Error(e); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, OnInit } from '@angular/core'; | |
declare const sforce; | |
interface Contact { | |
Id: string; | |
Name: string; | |
} | |
@Component({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<apex:page standardStylesheets="false" sidebar="false" showHeader="false" | |
applyBodyTag="false" applyHtmlTag="false" docType="html-5.0"> | |
<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'}" /> | |
<link rel="stylesheet" type="text/css" href="{!$Resource.AngularPOC + '/assets/main.css'}" /> |