Copied to clipboard

Flag this post as spam?

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


  • skiltz 501 posts 701 karma points
    Nov 28, 2014 @ 02:41
    skiltz
    0

    Customer Section - Angular Wireup

    I am new to Angular and Umbraco 7 :)

    Got the new section to load in Umbraco as expected. But I can't seem to wire up the Angular part of the equations.

    In App_Plugins I have a file called magazine.DeleteController.Js

    angular.module('umbraco').controller('magazine.DeleteController',
        function ($scope, $routeParams, customerResource, notificationsService, navigationService, $location, treeService) {
    
            $scope.Delete = function (id) {
                notificationsService.success("Success", "Magazine has been deleted");
            };
    
            $scope.Cancel = function () {
                navigationService.hideNavigation();
            };
        });

     

    In my delete.html I have the following

    <umb-panel ng-controller="magazine.DeleteController">
        <p>
            Are you sure you want to delete {{currentNode.name}} ?
        </p>
        <div>
            <div class="umb-pane btn-toolbar umb-btn-toolbar">
                <div class="control-group umb-control-group">
                    <a href="" class="btn btn-link" ng-click="Cancel()"><localize key="general_cancel">Cancel</localize></a>
                    <a href="" class="btn btn-primary" ng-click="Delete(currentNode.id)"><localize key="general_ok">OK</localize></a>
                </div>
            </div>
        </div>
    </umb-panel>

     

    If I look in chrome console i see the error.

    Error: Argument 'magazine.DeleteController' is not a function, got undefined
        at Error (native)

     

    What am I missing?

    Thanks!

     

     

     

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Nov 28, 2014 @ 04:34
    Dennis Aaen
    1

    Hi skiltz,

    First of all I must say that I haven't tried building a custom property editor or a custom section in Umbraco 7 using AngularJS.

    But I think this documentation http://umbraco.github.io/Belle/#/tutorials and http://umbraco.github.io/Belle/#/api , and the Angular Workbook https://github.com/umbraco/AngularWorkbook made by Per, from the Umbraco HQ could be good starting pointers.

    Or perhaps, this example of a person property editor can help you too. https://github.com/perploug/UkFest-AngularJS-Demo

    Hope this can help you.

    /Dennis

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Nov 28, 2014 @ 06:20
    Jan Skovgaard
    101

    Hi Skiltz

    Do you have a manifest in your folder where the view and controller is also referenced? Otherwise that's probably the culprit.

    If indeed everything is setup correctly then it's probably a cache issue.

    You need to clear your browser cache and make a hard reload. If you're using chrome it can be a good idea to keep the console log open and then make sure that there is a checkmark in the "Disable cache (while DevTools is open)" in your settings.

    Sometimes you'll also need to do the above things and then recycle the app pool to have the changes you make take effect.

    Hope this helps. Otherwise have a tight look at the exercises in the Angular Workbook that Dennis referenced above to make sure that you have setup everything correct. It could also be that there is a minor hard to see typo somewhere :)

    Hope this helps.

    Have fun angularing!

    /Jan

  • skiltz 501 posts 701 karma points
    Nov 28, 2014 @ 07:20
    skiltz
    0

    Was the manifest file :)

    Thanks!

     

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Nov 28, 2014 @ 07:27
    Jan Skovgaard
    0

    Hi Skiltz

    Cool - I hope you make some awesome stuff for your client :)

    /Jan

Please Sign in or register to post replies

Write your reply to:

Draft