Copied to clipboard

Flag this post as spam?

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

  • Maff 141 posts 465 karma points
    Dec 09, 2014 @ 16:18

    Problem creating custom Editor


    I'm following this how-to on creating a custom editor, and as far as I Can tell I'm doing everything correct, but I just can't get it to work:

    My code class looks like this:

      [Umbraco.Web.Trees.Tree("DataExport", "DataExportTree", "Data Export", iconClosed: "icon-doc")]
      public class DataExportTreeController : TreeController
        protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings)
          var nodes = new TreeNodeCollection();
          var parentNode = CreateTreeNode("exportData", id, queryStrings, "Export Data", "icon-truck", false);
          return nodes;
        protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings)
          var menu = new MenuItemCollection();
          return menu;


    My AngularJS controller code looks like this:

    'use strict';
    (function() {
      //create the controller
      function dataExportController($scope, $routeParams) {
        $scope.content = { tabs: [{ id: 1, label: "Export Organisation Data" }, { id: 2, label: "Export Member Data" }] };
      //register the controller
      angular.module("umbraco").controller('DataExport.DataExportTree.EditController', dataExportController);

    and my edit.html view looks like this:



    <div ng-controller="DataExport.DataExportTree.EditController">
    markup goes here...

    My App_Plugins folder structure looks like this:

    However, when I run Umbraco and navigate to my custom editor page I'm getting an error with the AngularJS Controller "Error: Argument 'DataExport.DataExportTree.EditController' is not a function, got undefined". If I take the ng-controller="DataExport.DataExportTree.EditController" tag out of my markup then the page renders with no errors (but obviously no AngularJS kicking in), so my tree configuration and paths all seem to be correct.

    The tutorial doesn't mention anything about how the javascript file is picked up by Umbraco - do I need to reference this in a .manifest file or somewhere else?

    Any clues would be greatly appreciated as I've been through this tutorial a few times now and I'm not getting anywhere... :s








  • Jan Skovgaard 11264 posts 23592 karma points MVP 8x admin c-trib
    Dec 09, 2014 @ 16:26
    Jan Skovgaard

    Hi Maff

    Not quite sure where things go wrong in the above code but just want to mention that you should try and check out the Umbraco Angular workbook at there is some sample code in chapter 5 I think, which you may be able to benefit from.

    Also yes your javascript needs to be referenced in the manifest as is shown in the examples in this book as well.

    Hope this helps a bit.


  • Maff 141 posts 465 karma points
    Dec 09, 2014 @ 16:29

    Thanks Jan - I'll check that out!


  • Dave Woestenborghs 3398 posts 11517 karma points MVP 6x admin c-trib
    Dec 09, 2014 @ 16:42
    Dave Woestenborghs

    As Jan already stated you have to add the js file to your package manifest

    For some example code on creating custom sections have a look at the source code of my DUUG and UmbUkFest talks

    And of course my slides of the DUUG talk which contains some useful links at the end :


  • Maff 141 posts 465 karma points
    Dec 09, 2014 @ 17:09

    Thanks Dave - the code in your first link helped me get it working! I think the issue was the manifest file was not in the root of my plugin, so my controller wasn't being registered...

    Thanks again :)


Please Sign in or register to post replies

Write your reply to: