angular-autoFields-bootstrap icon indicating copy to clipboard operation
angular-autoFields-bootstrap copied to clipboard

Create custom field select and ng-selected

Open openmotion opened this issue 8 years ago • 1 comments

hello i want to create a custom select element i have my data like this : "list": [ { "id": "lhEMz6vl", "name": "Qualit\u00e9" }, { "id": "EFJzlnk8", "name": "Hygi\u00e8ne & Sant\u00e9" }, ] i want my data appear in the exact position as in the original dataset

this is my directive, but the ng-selected do not work


TetxDirective.config(['$autofieldsProvider', function($autofieldsProvider){
	// Checkbox Field Handler
	$autofieldsProvider.registerHandler('select_adv', function(directive, field, index){
		
		 
		console.log(field);
		
		var current_value = field.value;
		console.log("current_value " + current_value);
		console.log("list "  );
	 
		
		var fieldElements = $autofieldsProvider.field(directive, field, '<select id="{{field.name}}" name="{{field.name}}" ng-model="list[0][\'foldertool_data\'][\'list\'][0] "   ng-options="option as option.name for option in list[0][\'foldertool_data\'][\'list\']  " >  </select>' );
 
		return fieldElements.fieldContainer;
	});
}]);

openmotion avatar Mar 07 '17 12:03 openmotion

Hey @openmotion I'm not sure I understand what you're trying to do. Can you show me with just normal HTML or something?

If I am understanding correctly I think you are using a special handler when you don't really need one.

JustMaier avatar Mar 11 '17 17:03 JustMaier