Do not install the controller on an element .: http://codepen.io/anon/pen/MwNgZx?editors=101
Updated Method:
function setCtrl() { var elem = document.getElementById('placeholder'); //elem.setAttribute('ng-controller', 'ctrl'); var eSpan = elem.children[0]; var eSelect = elem.children[1]; eSpan.setAttribute('ng-bind', 'name'); eSelect.setAttribute('ng-options', 'o as o for o in rows'); eSelect.setAttribute('ng-model', 'selectedValue'); var injector = angular.element(elem).injector(); var compile = injector.get('$compile'); var rootScope = injector.get('$rootScope'); var controller = injector.get('$controller'); var result = compile(elem)(rootScope); var ctrlInstance = controller('ctrl', {$scope:rootScope, value:'hello'}); }
Also, when you made your choice, you made children [1] .children [0], and that was wrong.
I assume that if you install ng-controller in an element, angular also tries to instantiate, but does not know where to get the value parameter.
Edit
And I made an example of doing what you wanted him to do .. I think :)
source share