(function () {
//Add the resource to umbraco.resources modules:
angular.module('umbraco.resources').factory('personResource', function ($q, $http, umbRequestHelper)
//This uses the standard angular factory pattern, so we can now inject this into any of our controllers under the name personResource.
{
//the factory object returned
return {
//this calls the Api controller we set up earlier
getAll: function () {
//return umbRequestHelper.resourcePromise($http.get("http://mysite.local/umbraco/My/PersonApi/GetAll"), "Failed to retrieve all Person data");
return $http.get("http://mysite.local/umbraco/My/PersonApi/GetAll");
}
};
});})();
As I'm not sure how you've set things up in the backoffice, with your Document Types and your templates, I'm shooting in the dark.
What version of Umbraco are you using?
Are you getting error messages?
Even then, according to your logic, I can only see the last name in the array getting bound to the model but not all of them.
I would add another line in the function below to bind the values to the model directly once the data is successfully fetched.
angular.module("umbraco")
.controller("My.PersonPickerController", function ($scope, personResource) {
personResource.getAll().then(function (response) {
$scope.people = response.data;
$scope.model.value = $scope.people; //New line of code
});
});})();
Once you save the page back, I believe the data will get bound to the "personPropertySettings" property which you can then fetch and iterate over in the front end and display the information.
How to display Server Side Data on a page
Hello Guys
I'm going through the Tutorials of Belle Api Documentation. And I am on the tutorial Add Server Side Data.
Everything work perfect in the back office.
But I am not able to display the data on the main website.
1.This is my package manifest
my js codes
person.resource.js
personpicker.controller.js
personapicontroller
personresource.hmtl
The data in backoffice is indeed being displayed as shown below.
But I am not able to display it on the website
This is the code I have written on the template.
Can you guys what I'm doing wrong? Maybe the code I have written on the template is not right.
The belle tutorials really lack proper documentation. :(
Thank you
Heveen,
You've listed the people in the backoffice screen, but have you actually assigned a value to the field you want to display?
Muiris
yes, thats what i did in the template.
@umbraco.Field("personPropertySettings")
Is it the right way?
I meant did you actually assign a value in the backoffice to store in that field. You might be trying to display a value that hasn't been set.
Hello
The Value is already stored in the database.
I have followed the tutorials and able to display the values from the database in the back office.
Now, I want to display the value on Front which I am not able to do it.
The tutorial, unfortunately, does not provide enough information about that.
The concept of Umbraco is to do configuration on the back office and display it on the front. But the tutorial does not explain that concept.
Maybe you need to pass the model to the template, e.g.
As I'm not sure how you've set things up in the backoffice, with your Document Types and your templates, I'm shooting in the dark. What version of Umbraco are you using? Are you getting error messages?
I am not an expert in angular, but is this a proper way to bind a value to the model?
Even then, according to your logic, I can only see the last name in the array getting bound to the model but not all of them.
I would add another line in the function below to bind the values to the model directly once the data is successfully fetched.
Once you save the page back, I believe the data will get bound to the "personPropertySettings" property which you can then fetch and iterate over in the front end and display the information.
I remember trying this tutorial last year and found some useful tips here:
https://github.com/TimGeyssens/UmbracoAngularBackofficePages
which I used to cobble together a property editor.
is working on a reply...