Copied to clipboard

Flag this post as spam?

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


  • David Parr 48 posts 206 karma points
    Aug 19, 2015 @ 13:47
    David Parr
    0

    'Argument is not a function, got undefined' JS error in custom section

    Hi,

    Update - The package.manfiest file isn't loading. I suppose that now poses a different question. Why isn't it loading? The path is correct and there's only one package.manfiest file in the folder. I've cleared Client Dependency cache and browser cache, touched web.config too, even restarted IIS express.

    I'm getting the following javascript error in 7.2.6 when building a custom section in the back office of Umbraco. (When clicking on a root tree node to load up the edit view).

    Argument 'MyApp.MyEditController' is not a function, got undefined
    

    As you can see MyApp.MyEditController is just a simple test. My edit.html is as follows:

    <div ng-controller="MyApp.MyEditController"></div>
    

    My package.manfiest file (located at /App_Plugins/MyApp/package.manifest) contains:

    {
      javascript: [
          '~/App_Plugins/MyApp/BackOffice/MyAppTree/controllers/edit.controller.js'
      ]
    }
    

    And finally the edit.controller.js is also very basic:

    angular.module("umbraco").controller("MyApp.MyAppEditController", 
    
        function ($scope, $routeParams, notificationsService, navigationService) {
    
        console.log($routeParams);
    });
    

    Whether it's a simple test like this or not the issue persists.

    Does anyone have any idea why this is happening?

    Note the section itself works fine otherwise, it is only on the edit view of a tree node.

    The package.manfiest file isn't loading. I suppose that now poses a different question. Why isn't it loading? The path is correct and there's only one package.manfiest file in the folder.

    Thanks,

    Dave

  • Comment author was deleted

    Aug 19, 2015 @ 14:14

    For posterity purposes.

    Looks like we solved it by recreating the manifest due an errant character (invisible).

  • David Parr 48 posts 206 karma points
    Aug 19, 2015 @ 14:20
    David Parr
    102

    Ok this has been solved. A rather odd solution so incase anyone else gets this problem in future.

    The issue was because of bom characters. I tried to recreate the package.manifest file in Visual Studio with no joy but then created it again without BOM encoding and it now works fine!

    To save a file without BOM in Visual Studio you can:

    File > Advanced Save Options > Choose 'UTF-8 without signature'.

    Thanks to Kevin for the tip to check BOM! :)

    Thanks

    Dave

  • TheOriginal 22 posts 122 karma points
    May 12, 2016 @ 10:25
    TheOriginal
    0

    I have come accross the same error yet nothing seems to fix it. I have recycled my pool in IIS, I've cleared the browser cached, I've resaved the manifest following the instructions above, I've recreated the whole file twice yet every time still getting the same error

  • Simon Justesen 74 posts 193 karma points
    Jul 28, 2016 @ 16:10
    Simon Justesen
    1

    Had the same error with Umbraco 7.4.3. Tried clearing the browsers cache, recycle the app pool etc. Didn't work.

    Solved it by moving my controller file away from the "package.manifest"-file to a separate directory and after that I altered the path to the file in package.manifest

  • Avatar 15 posts 92 karma points
    Jun 12, 2017 @ 23:20
    Avatar
    1

    Wow man, thank you for posting that because that also solved it for me. So the manifest can't be in the same directory as the files it references? That is so weird to me.

    Thanks again for posting your solution, ugh, I can't believe it was something so simple as that!

  • Simon Justesen 74 posts 193 karma points
    Jun 04, 2018 @ 23:45
    Simon Justesen
    0

    Cool! Glad it worked out for you (sorry for reposting, I deleted my previous reply by mistake)

Please Sign in or register to post replies

Write your reply to:

Draft