Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

replace:false in directive doesn't "append" as documented #2235

Closed
@jokeyrhyme

Description

@jokeyrhyme

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions