我正在尝试重现AngularUI的模态视图和动态分配控制器的角度材料行为的对话框视图,并能够将值作为参数发送
我试图模仿 AngularUI 代码但没有成功:
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);
它适用于动态分配控制器而不传递值。我究竟做错了什么?