I am trying to create a directive called select that replaces the select element. To be more precise, it hides the select element and shows a custom drop-down menu. Here is the jsfiddle in which I am trying to do this.
So, suppose the following select element:
<select ng-model="selectedOption">
<option ng-repeat="option in options" ng-bind="option.value"></option>
</select>
Now this select directive should translate this code into the following template:
<section>
<div ng-transclude></div>
<ol>
<li ng-repeat="option in options" ng-bind="option.value">
</ol>
</section>
And the directive:
myApp.directive('select', function() {
return {
templateUrl: 'view/select.html',
restrict: 'E',
transclude: true,
scope: {},
link: function(scope, element, attrs) {}
};
});
Now I see a couple of problems:
- Transclude seems to replace the whole template (see jsfiddle )
- there is a strange element
option - how do i get the attached data because i need this to create a custom dropdown
Hope someone can help me here!
Thnx
UPDATE: , , , select, - - . , , select. , , $prestine, up2date
UPDATE2: , : jsfiddle. , :( !