Copied to clipboard

Flag this post as spam?

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


  • Tiago 12 posts 93 karma points
    Apr 20, 2017 @ 11:00
    Tiago
    0

    Umbraco.MainController not found

    I get the following error 'Umbraco.MainController not found' when including my custom grid editor controller in the package.manifest.

    {
    "gridEditors": [
    {
      "name": "Button",
      "alias": "myButton",
      "view": "/App_Plugins/LeadzIT/ButtonEditor/editor.html",
      "render": "/App_Plugins/LeadzIT/ButtonEditor/Button.cshtml",
      "icon": "icon-coin"
    }
    ],
      "javascript": [
        "/App_Plugins/LeadzIT/ButtonEditor/ButtonEditor.controller.js"
      ]
    }
    

    And then the controller is referenced in the editor.html, all as is defined in the custom grid editor tutorial.

    THE PROBLEM: When I try and enter the back office, an error occurs saying: 'Argument 'Umbraco.MainController' is not a function, got undefined'.

    From the tutorial I did change one thing which was the definition of the scope variables:

    angular.module("umbraco", []).controller("LeadzIT.ButtonEditor.controller", ['$scope', function ($scope) {
       // Configure the properties dor this editor.
       if (!$scope.control.value["text"]) 
           $scope.control.value["text"] = "";
    
       if (!$scope.control.value["url"])
           $scope.control.value["url"] = "";
    
       if (!$scope.control.value["newWindow"])
           $scope.control.value["newWindow"] = false;
    
       if (!$scope.control.value["theme"])
           $scope.control.value["theme"] = "";
    }]);
    

    I initially had this same problem when I developed this simple grid editor, and I resolved it by adding the scope variable declaration. I recently upgraded from 7.5.11 to 7.5.13 and this error came back.

    If I comment out the controller from the manifest then the back office opens with no problem, but then the grid editor obviously does not work.

    Any help would be apreciated!

Please Sign in or register to post replies

Write your reply to:

Draft