10.07.2015 Views

belle-workbook

belle-workbook

belle-workbook

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Step 4: Adding Serverside Data to aProperty EditorOverviewIn this tutorial we will add a serverside API controller, which will query a custom table in theumbraco database, and then return the data to a simple angular controller + view.The end result will be a person-list, populated from a custom table, when clicked it will storethe ID of the selected person.Setup the DatabaseFirst thing we need is some data, below is a simple SQL Script for create a people table withsome random data in. You could also use http://generatedata.com for larger amounts of data:CREATE TABLE people (id INTEGER NOT NULL IDENTITY(1, 1),name VARCHAR(255) NULL,town VARCHAR(255) NULL,country VARCHAR(100) NULL,PRIMARY KEY (id));GOINSERT INTO people(name,town,country) VALUES(‘Myles A. Pearson’,’Tailles’,’UnitedKingdom’);INSERT INTO people(name,town,country) VALUES(‘Cora Y. Kelly’,’Froidchapelle’,’Latvia’);INSERT INTO people(name,town,country) VALUES(‘Brooke Baxter’,’Mogi dasCruzes’,’Grenada’);INSERT INTO people(name,town,country) VALUES(‘Illiana T. Strong’,’Bevel’,’Bhutan’);INSERT INTO people(name,town,country) VALUES(‘Kaye Frederick’,’Rothesay’,’Turkmenistan’);INSERT INTO people(name,town,country) VALUES(‘Erasmus Camacho’,’Sint-Pieters-Kapelle’,’SaintVincent and The Grenadines’);INSERT INTO people(name,town,country) VALUES(‘Aimee Sampson’,’Hawera’,’Antiguaand Barbuda’);

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!