I'm trying to reproduce the modal view of AngularUI and dialog view of angular material behavior of assigning a controller dynamically and be able to send values as arguments
I tried to mimic AngularUI code without success:
var elem = document.getElementById('placeholder');
elem.setAttribute('ng-controller', 'ctrl');
var injector = angular.element(elem).injector();
var compile = injector.get('$compile');
var rootScope = injector.get('$rootScope');
var controller = injector.get('$controller');
var ctrlInstance = controller('ctrl', {$scope:rootScope, value:'hello'});
var result = compile(elem)(rootScope);
It works for dynamically assigning the controller without passing the value. What am I doing wrong?