Copied to clipboard

Flag this post as spam?

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


  • Timo Perplex 13 posts 145 karma points c-trib
    Sep 30, 2014 @ 12:10
    Timo Perplex
    0

    dialogService.open doesn't render the template the second time

    Hi,

    I'm experiencing some troubles with the dialogService.open functionality. The first time I open a dialog it`s all working fine, but the second time I open the dialog only the controller code is working but the template is no longer parsed.

    The code for opening the dialog is as follows:

        dialogService.open({
            template: '../App_Plugins/MemberManagement/MemberDialogView.html',
            scope: $scope,
            callback: function (data) {
                console.log(data);
            },
            show: true,
            dialogData: {
                member: member,
            }
        });
    

    The attached view:

    <div ng-controller="MemberDialogView.Controller" ng-init="init();" class="umb-panel">
        <div class="umb-panel-header">
            <h1>Wijzig gebruiker</h1>
        </div>
        <div class="umb-panel-body with-footer">
            {{member | json }}
        </div>
    </div>
    

    The dialog controller code is very basis:

    angular.module("umbraco").controller("MemberDialogView.Controller", function ($scope, MemberResource) {
        // The dialogdata contains the member
        $scope.member = $scope.dialogData.member;
    });
    

    The first time I open the dialog it shows the member object in json, the second time it shows "{{member | json }}". It looks like AngularJS is not "compiling"(?) the html the second time. Any console.logs I have in the MemberDialogView.Controller run just fine and are working as expected even the second time.

    Does anyone know how or why this is not working? When I look at the examples none of them use a cleanup or parse function to rerender the html.

  • Timo Perplex 13 posts 145 karma points c-trib
    Oct 02, 2014 @ 08:50
    Timo Perplex
    100

    The problem arose because I passed the original scope to the dialog. After removing the scope it all worked brilliantly!

Please Sign in or register to post replies

Write your reply to:

Draft