uiInclude
is an alternative to ngInclude
that adds fragment support via a fragment
attribute. The
fragment attribute uses the element.find()
API, and therefore requires jQuery in order to support full CSS
selectors; Without jQuery, it falls back to Angular's jqLite
implementation which is very limited as it only selects by element
name.
Use this instead of ngInclude
only if you need
fragments. Fragment support has two primary uses: (1) it serves as a
drop in replacement for jQuery.load(), which permits a
subset of a requested document to be selected, and (2) because some
people want to put multiple templates into a single file and they need a
way to select which specific fragment to use. The former use is
expected to be benefit projects that are migrating from jQuery to
Angular.
fragment="'{{uiIncludeFragment}}'"
):
<ui-include src="'my/url/to/partial/file'" fragment="'#id-to-fragment'"></ui-include> <!-- Don't forget to quote string literals! --> <!-- Don't forget to include jQuery if you need full selector support! -->