Copied to clipboard

Flag this post as spam?

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


  • Jakob Kristensen 36 posts 169 karma points
    Dec 20, 2017 @ 15:13
    Jakob Kristensen
    0

    Angular submit in custom section posts twice

    Hello guys/gals

    Im having issues with angular in the backend while making a custom section, so far ive got a controller and whenever i submit a form on the page it double posts?

    i am suspecting i am having multiple controllers spawned after reading this post about double submits: http://www.saintsatplay.com/blog/2015/06/resolving-angularjs-executing-controller-twice-issue#.Wjp2dN-nFaQ

    my controller looks like this (i do this to get my custommodules since i cant define them regularly in module("umbraco",['ui.sortable'])

        var app = angular.module("umbraco");
    app.requires.push('ui.sortable');
    app.controller('Administration.CaseDetailController', function ($scope, administrationResources, notificationsService, $routeParams, $http) {
    });
    

    and my html:

    <umb-panel ng-controller="Administration.CaseDetailController"></umb-panel>
    

    So my question is if i cant define the controller inside html anymore how will i go about routing this, or maybe there is another way, anyone tried anything like this?

    And yes i use a regular button with an ng-submit tag going to create case, this was working before i needed a custom module for sorting..

  • Alex Brown 129 posts 620 karma points
    Dec 21, 2017 @ 15:38
    Alex Brown
    0

    Have you got any other buttons in the form other than submit? Such as a "clear" button or "back" etc.

    I've used custom sections before and had two buttons in a form, one of which didn't specify the type of button. I had to add the type="button" attribute to my delete button so that it didn't post when my submit button did.

  • Jakob Kristensen 36 posts 169 karma points
    Dec 22, 2017 @ 13:14
    Jakob Kristensen
    0

    I did have an extra i removed all the buttons extra as per the article i sent, it would do the same thing so with no extra buttons its still double posting hence why i was thinking it might be posted double, i also tried to stop the event from going through a second time with a bool and still went through which indicates there is 2 controllers.

  • Jakob Kristensen 36 posts 169 karma points
    Dec 27, 2017 @ 09:18
    Jakob Kristensen
    0

    So apparantly this wasnt angular but an issue in my controller that would retry, so no extra controllers added :)

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies