1
votes

I need to open a dialog and pass it some options. The idea is to have a template popup that i can change the title and message depending on the thing calling it. So I have a better alert().

Docs have some code on passing it parent scope, but how do i pass my own object and retrieve it?

angular.module('myApp').controller('MyController', function($scope) {
ons.ready(function() {
ons.createDialog('dialog.html', {parentScope: $scope}).then(function(dialog) {
  $scope.dialog = dialog;
});
});

// This variable will be available in the dialog scope as well.
$scope.myVariable = 'Hello!';
});

So basically how do i pass it a object and access it in my dialog's controller:

app.controller('generalSucessPopupController', function($scope){



});
1

1 Answers

0
votes

You could try to do $rootScope.myVariable = 'Hello!'; this will make it available on all controllers. Then on the dialog controller you can call it like $rootScope.myVariable;

Note: Remember to declare $rootScope on your controller's function params.