Copied to clipboard

Flag this post as spam?

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


  • Casper 70 posts 308 karma points
    Apr 28, 2014 @ 11:41
    Casper
    1

    dialogService - How to get data back from dialog view?


    ANSWER: had to call submit(data) to raise the callback :) - doh!


    Hi brains,

    I have a controller that need to open a dialog and pass some text to it. The dialog view modifies the dialogData.text and then it should raise the callback i pass - but it seems im doing it wrong.

    How do i get the callback raised, so i can get data back from the opened dialog?

    // some.controller.js
    angular.module("umbraco").controller("some.controller", function ($scope, dialogService) {
    
    
        // <button ng-click="openDialogClick()">Open dialog</button>
    
        $scope.openDialogClick = function () {
    
          var ds = dialogService.open({
              template: '../App_Plugins/testplugin/dialogview.html',
              scope: $scope,
              callback: function (data) {
                  console.log(data);
              },
              show: true,
              dialogData: {
                  text: 'some text'
                }
            });
        };
    
    };
    
    // dialoglogview.controller.js
    angular.module("umbraco").controller("dialogview", function ($scope, dialogService) {
    
        console.log($scope.dialogData); // works
    
        // <button ng-click="okClick()">OK</button>
    
        $scope.okClick = function() {
    
            // raise callback - how?
    
            // $scope.callback($scope.dialogData.text);
    
            // YEAH!
            $scope.submit($scope.dialogData.text);
    
        };
    
    
    };
    
  • Casper 70 posts 308 karma points
    Apr 28, 2014 @ 12:35
    Casper
    101

    ANSWER: Sweetness. had to call submit(data) to raise the callback :)

Please Sign in or register to post replies

Write your reply to:

Draft