replace:false in directive doesn't "append" as documented #2235
Description
From the official documentation http://docs.angularjs.org/guide/directive (search for replace -
):
replace - if set to true then the template will replace the current element, rather than append the template to the element.
I am using replace:false
in combination with templateUrl:...
. The target element in question already contains some content generated by a server-side script, and I merely wish to add to it with a directive. The documentation suggests that replace:false
will cause the template content to be appended to the target element.
Instead, the template content completely replaces the content of the target element. The culprit lines of code are here:
https://github.com/angular/angular.js/blob/master/src/ng/compile.js#L695
https://github.com/angular/angular.js/blob/master/src/ng/compile.js#L1012
Notice that angular.element.html()
is being used here instead of angular.element.append()
.
Should the documentation be altered to match the implementation? Or the reverse?
Also, is there a temporary work around I can employ to get my template data playing nicely with existing content as desired?
Cheers.
PS. I am using jQuery 1.7.2 with Angular JS 1.0.5.