angular.widget.ng:include
Description
Include external HTML fragment.
Keep in mind that Same Origin Policy applies to included resources
(e.g. ng:include won't work for file:// access).
Usage
In HTML Template Binding
<ng:include src="..." [scope="..."] onload="..."></ng:include>
Parameters
- src –
{string}
– expression evaluating to URL.
- scope –
{Scope=}
[new_child_scope]
– expression evaluating to angular.scope
- onload –
{string=}
– Expression to evaluate when a new partial is loaded.
Example
<select name="url">
<option value="angular.filter.date.html">date filter</option>
<option value="angular.filter.html.html">html filter</option>
<option value="">(blank)</option>
</select>
<tt>url = <a href="{{url}}">{{url}}</a></tt>
<hr/>
<ng:include src="url"></ng:include>
it('should load date filter', function(){
expect(element('.doc-example ng\\:include').text()).toMatch(/angular\.filter\.date/);
});
it('should change to hmtl filter', function(){
select('url').option('angular.filter.html.html');
expect(element('.doc-example ng\\:include').text()).toMatch(/angular\.filter\.html/);
});
it('should change to blank', function(){
select('url').option('(blank)');
expect(element('.doc-example ng\\:include').text()).toEqual('');
});