Copied to clipboard

Flag this post as spam?

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

  • Mihail 39 posts 142 karma points
    Jun 07, 2017 @ 07:06

    Data is not saved if use custom property editor in Umbraco

    I create custom property editor which takes all available languages in Umbraco like:

    angular.module("umbraco").controller("MyLanguageController", function ($scope, myLanguageService) {
       $scope.items = [];
       myLanguageService.getAll().then( function( result ) {
          if( result && && ) {
             $scope.items =;
       } );


       .factory("myLanguageService", function ($http) {
          return {
             getAll: function () {
                return $http.get("/umbraco/backoffice/MyControllerSide/GetAll", { "dataType": "json" });

    The view:

    <div ng-controller="MyLanguageController" id="language">
          <li ng-repeat="item in items" class="checkbox">
                <input type="checkbox" value="{{item.IsoCode}}"> {{item.CultureName}}

    The package manifest contains:

        propertyEditors: [
                alias: "MyLanguageAlias",
                name: "Language Selector",
                icon: "icon-umb-translation",
                hideLabel: true,
                valueType: "JSON",
                editor: {
                    view: "~/App_Plugins/MyLanguageSelector/backoffice/view.html"

    and C# code:

      public JsonResult GetAll()
         IEnumerable<ILanguage> languages = ApplicationContext.Services.LocalizationService.GetAllLanguages() ?? new List<ILanguage>(0);
         IEnumerable<TranslationLanguageModel> model =
            languages.Select(s => new MyLanguageModel { CultureName = s.CultureInfo.DisplayName, IsoCode = s.IsoCode });
         return Json(model, JsonRequestBehavior.AllowGet);

    I created new data type in Umbraco/Developer section, and I add it in document type:

    enter image description here

    When I save document, the value for that property is null. I don't understand why.

    And when come back to content, then nothing is checked.

    What should I do ?

  • Delete 61 posts 450 karma points
    Jun 07, 2017 @ 07:59


    Because you don't store the value you need.

    <input type="checkbox" value="{{item.IsoCode}}"> {{item.CultureName}}

    There is not enough parts of the code like this. But, this code you need check.

     <input type="checkbox" ng-model="model.value" value="{{item.IsoCode}}"> {{item.CultureName}}

    Another example

    You may need to add a new method that will call when you select some options and will save the correct value in the model.value in angular controller.



Please Sign in or register to post replies

Write your reply to: