From b49ddf9848952a95032e9962796ec3a6e50857de Mon Sep 17 00:00:00 2001 From: Vojta Jina Date: Wed, 29 Feb 2012 14:56:29 -0800 Subject: docs($route, ng:view): Fix the examples to work on jsfiddle, update docs --- src/widgets.js | 113 ++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 67 insertions(+), 46 deletions(-) (limited to 'src/widgets.js') diff --git a/src/widgets.js b/src/widgets.js index 66ea7fef..8bfd232d 100644 --- a/src/widgets.js +++ b/src/widgets.js @@ -475,61 +475,82 @@ var ngNonBindableDirective = valueFn({ terminal: true }); * * @description * # Overview - * `ng:view` is a widget that complements the {@link angular.module.ng.$route $route} service by + * `ng:view` is a directive that complements the {@link angular.module.ng.$route $route} service by * including the rendered template of the current route into the main layout (`index.html`) file. * Every time the current route changes, the included view changes with it according to the * configuration of the `$route` service. * - * This widget provides functionality similar to {@link angular.module.ng.$compileProvider.directive.ng:include ng:include} when - * used like this: - * - * - * - * - * # Advantages - * Compared to `ng:include`, `ng:view` offers these advantages: - * - * - shorter syntax - * - more efficient execution - * - doesn't require `$route` service to be available on the root scope - * * * @example - - -
- overview | - bootstrap | - undefined - -
- - The view is included below: -
- -
+ + + + + + + +
+ Choose: + Moby | + Moby: Ch1 | + Gatsby | + Gatsby: Ch4 | + Scarlet Letter
+ + +
+ +
$location.path() = {{$location.path()}}
+
$route.current.template = {{$route.current.template}}
+
$route.current.params = {{$route.current.params}}
+
$route.current.scope.name = {{$route.current.scope.name}}
+
$routeParams = {{$routeParams}}
+
- it('should load templates', function() { - element('.doc-example-live a:contains(overview)').click(); - expect(element('.doc-example-live ng\\:view').text()).toMatch(/Developer Guide: Overview/); - - element('.doc-example-live a:contains(bootstrap)').click(); - expect(element('.doc-example-live ng\\:view').text()).toMatch(/Developer Guide: Initializing Angular: Automatic Initialization/); + it('should load and compile correct template', function() { + element('a:contains("Moby: Ch1")').click(); + var content = element('.doc-example-live ng\\:view').text(); + expect(content).toMatch(/controller\: ChapterCntl/); + expect(content).toMatch(/Book Id\: Moby/); + expect(content).toMatch(/Chapter Id\: 1/); + + element('a:contains("Scarlet")').click(); + content = element('.doc-example-live ng\\:view').text(); + expect(content).toMatch(/controller\: BookCntl/); + expect(content).toMatch(/Book Id\: Scarlet/); });
-- cgit v1.2.3