My goal is to develop a directive that includes the ng-transclude value in the input field's value attribute within an HTML template:
The directive I have created:
module.directive('editInput', function(){
return {
restrict: 'E',
scope: {
value: '='
},
transclude: true,
template: '<p ng-show="value == false" ng-transclude></p>' +
'<input ng-show="value == true" placeholder="" value="" ng-transclude/>'
}
});
I am looking for a solution that adds ng-transclude value to the value attribute of the input element.
Here is the template in use:
<edit-input value="isEditModeActive">{{person.name}}</edit-input>
Currently, the generated HTML output looks like this:
<input ng-show="value == true" placeholder="" value="" ng-transclude="" class="">
<span class="ng-binding">Name</span></input>
However, the desired HTML output should be:
<input ng-show="value == true" placeholder="" value="Name">