aboutsummaryrefslogtreecommitdiffstats
path: root/src/ng/directive/ngInclude.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/ng/directive/ngInclude.js')
-rw-r--r--src/ng/directive/ngInclude.js76
1 files changed, 41 insertions, 35 deletions
diff --git a/src/ng/directive/ngInclude.js b/src/ng/directive/ngInclude.js
index 9796b4e1..6d89e847 100644
--- a/src/ng/directive/ngInclude.js
+++ b/src/ng/directive/ngInclude.js
@@ -26,41 +26,47 @@
* - Otherwise enable scrolling only if the expression evaluates to truthy value.
*
* @example
- <doc:example>
- <doc:source jsfiddle="false">
- <script>
- function Ctrl($scope) {
- $scope.templates =
- [ { name: 'template1.html', url: 'examples/ng-include/template1.html'}
- , { name: 'template2.html', url: 'examples/ng-include/template2.html'} ];
- $scope.template = $scope.templates[0];
- }
- </script>
- <div ng-controller="Ctrl">
- <select ng-model="template" ng-options="t.name for t in templates">
- <option value="">(blank)</option>
- </select>
- url of the template: <tt><a href="{{template.url}}">{{template.url}}</a></tt>
- <hr/>
- <div ng-include src="template.url"></div>
- </div>
- </doc:source>
- <doc:scenario>
- it('should load template1.html', function() {
- expect(element('.doc-example-live [ng-include]').text()).
- toBe('Content of template1.html\n');
- });
- it('should load template2.html', function() {
- select('template').option('1');
- expect(element('.doc-example-live [ng-include]').text()).
- toBe('Content of template2.html\n');
- });
- it('should change to blank', function() {
- select('template').option('');
- expect(element('.doc-example-live [ng-include]').text()).toEqual('');
- });
- </doc:scenario>
- </doc:example>
+ <example>
+ <file name="index.html">
+ <div ng-controller="Ctrl">
+ <select ng-model="template" ng-options="t.name for t in templates">
+ <option value="">(blank)</option>
+ </select>
+ url of the template: <tt>{{template.url}}</tt>
+ <hr/>
+ <div ng-include src="template.url"></div>
+ </div>
+ </file>
+ <file name="script.js">
+ function Ctrl($scope) {
+ $scope.templates =
+ [ { name: 'template1.html', url: 'template1.html'}
+ , { name: 'template2.html', url: 'template2.html'} ];
+ $scope.template = $scope.templates[0];
+ }
+ </file>
+ <file name="template1.html">
+ Content of template1.html
+ </file>
+ <file name="template2.html">
+ Content of template2.html
+ </file>
+ <file name="scenario.js">
+ it('should load template1.html', function() {
+ expect(element('.doc-example-live [ng-include]').text()).
+ toMatch(/Content of template1.html/);
+ });
+ it('should load template2.html', function() {
+ select('template').option('1');
+ expect(element('.doc-example-live [ng-include]').text()).
+ toMatch(/Content of template2.html/);
+ });
+ it('should change to blank', function() {
+ select('template').option('');
+ expect(element('.doc-example-live [ng-include]').text()).toEqual('');
+ });
+ </file>
+ </example>
*/