Skip to content

reference html data container

ubuntu edited this page Jan 25, 2016 · 1 revision

data-container

Important: the data-container attribute should be inserted in one of your tags in the index page, or the main pages of your application.

Set the HTML default container where the pages will be downloaded, if no target was specified.

When working in the same window, the pages are usually loaded by using <a href="#/url" data-target="[container]">, if no data-target is provided. The library try to guess the container from the url, name. if no container exists for that name, the content will be loaded into a tag containing the data-container attribute.

Also, when opening a new page, we have just the url, so no container is explicitly defined , and the same process as above is executed to guess the container.

See also href & data-target.

Examples:

<!--set the default container -->
<section data-container></section>
<!--set a custom container-->
<section id="my-container"></section>

<!--download page into my-container, by explicitly targeting the container-->
<a href="#/your-page.html" data-target="#my-container">your page</a>

<!--download page into my-container, by figuring out the container-->
<a href="#/my-container.html">your page</a>

<!--download page into default container-->
<a href="#/other-container.html">other page</a>

Another example (when opening an url)

// this url will load first the http://myserver.com/myapp/ page,
// and then it will try to download details.html into #details container,
// if not found, it will load into any tag wit data-container attribute,
// if not found it will load into the <body> tag

url= http://myserver.com/myapp/#/details.html

Clone this wiki locally