ng-repeat in combination with custom directive
问题 I'm having an issue with using the ng-repeat directive in combination with my own custom directive. HTML: <div ng-app="myApp"> <x-template-field x-ng-repeat="field in ['title', 'body']" /> </div> JS: angular.module('myApp', []) .directive('templateField', function () { return { restrict: 'E', compile: function(element, attrs, transcludeFn) { element.replaceWith('<input type="text" />'); } }; }); See jSFiddle The problem here is that nothing is replaced. What I'm trying to accomplish is an