Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Patrick Robin 34 posts 104 karma points
    Oct 25, 2015 @ 17:13
    Patrick Robin
    0

    Property Editor help

    I'm trying to create a simple property editor that pulls values from an api and displays them as a drop down list.

    Largely everything has gone okay and the list is displayed and when selected the value is saved in the database. The problem is that when you go to edit the document type again it doesn't set the selected item in the list.

    My controller looks like this:

    angular.module("umbraco")
    .controller("Emailer.PickerController",
        function ($scope, $http) {
            $http.get("/umbraco/backoffice/api/EmailerApi/GetAll/").success(function (data) {
                $scope.forms = data;
            }).error(function () {
    
            });
        });
    

    And my view looks like this:

    <div ng-controller="Emailer.PickerController">
    <select class="umb-editor umb-dropdown" required>
        <option ng-repeat="form in forms" value="{{form.Reference}}" ng-selected="{{form.Reference == model.value}}">{{form.Name}}</option>
    </select>
    <textarea ng-model="model.value"></textarea>
    

    And my package manifest looks like this:

    {
    propertyEditors: [
        {
            alias: "Emailer.Picker",
            name: "Emailer Picker",
            editor: {
                view: "~/App_Plugins/Emailer/picker.html",
                valueType: "STRING"
            }
        }
    ],
    
    javascript: [
        "~/App_Plugins/Emailer/picker.controller.js"
    ]
    

    }

    Any body got any ideas where I'm going wrong?

  • Comment author was deleted

    Oct 25, 2015 @ 17:16

    Could you see what happen if you set the ng-model directive in the select so

    <select ng-model="model.value">
    ...
    
  • Patrick Robin 34 posts 104 karma points
    Oct 25, 2015 @ 17:45
    Patrick Robin
    0

    Thought I'd tried that already but obviously not as now I've added it in it's all working as expected. Cheers for the help and the rapid response!

  • Comment author was deleted

    Oct 25, 2015 @ 17:51

    Great, glad it's working :)

Please Sign in or register to post replies

Write your reply to:

Draft