# Pastebin mwkVfI6p const cmp_rolePickerController = function rolePicker($scope, $element, $attrs, cmp_rolePickerService) { const ctrl = this ctrl.update = function(prop, value){ ctrl.onUpdate() } ctrl.$onChanges = function(newObj){ if(Array.isArray(newObj.roles.currentValue) && newObj.roles.currentValue.length > 0){ ctrl.selectedRole = newObj.roles.currentValue[0] newObj.selectedRole = newObj.roles.currentValue[0] } } ctrl.$onInit = function(){ if(Array.isArray(ctrl.roles) && ctrl.roles.length > 0) ctrl.selectedRole = ctrl.roles[0] //do init stuff }