Merge remote-tracking branch 'origin/master'
# Conflicts: # README.md # public/docs/ts/latest/_data.json # public/docs/ts/latest/cheatsheet.jade # public/docs/ts/latest/glossary.jade # public/docs/ts/latest/guide/_data.json # public/docs/ts/latest/guide/router.jade # public/docs/ts/latest/quickstart.jade
This commit is contained in:
		
						commit
						3d40a26655
					
				
							
								
								
									
										30
									
								
								.eslintrc.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								.eslintrc.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,30 @@ | ||||
| module.exports = { | ||||
|     "globals": { | ||||
|         "describe": true, | ||||
|         "beforeEach": true, | ||||
|         "it": true, | ||||
|         "expect": true | ||||
|     }, | ||||
|     "env": { | ||||
|         "node": true | ||||
|     }, | ||||
|     "extends": "eslint:recommended", | ||||
|     "rules": { | ||||
|         "indent": [ | ||||
|             "error", | ||||
|             2 | ||||
|         ], | ||||
|         "linebreak-style": [ | ||||
|             "error", | ||||
|             "unix" | ||||
|         ], | ||||
|         "quotes": [ | ||||
|             "error", | ||||
|             "single" | ||||
|         ], | ||||
|         "semi": [ | ||||
|             "error", | ||||
|             "always" | ||||
|         ] | ||||
|     } | ||||
| }; | ||||
| @ -2,7 +2,7 @@ dist: trusty | ||||
| sudo: required | ||||
| language: node_js | ||||
| node_js: | ||||
|   - "5" | ||||
|   - "6" | ||||
| os: | ||||
|   - linux | ||||
| env: | ||||
|  | ||||
| @ -1212,7 +1212,7 @@ function filterOutExcludedPatterns(fileNames, excludeMatchers) { | ||||
| } | ||||
| 
 | ||||
| function apiSourceWatch(postBuildAction) { | ||||
|   var srcPattern = [path.join(ANGULAR_PROJECT_PATH, 'modules/@angular/src/**/*.*')]; | ||||
|   var srcPattern = [path.join(ANGULAR_PROJECT_PATH, 'modules/@angular/**/*.*')]; | ||||
|   gulp.watch(srcPattern, {readDelay: 500}, function (event, done) { | ||||
|     gutil.log('API source changed'); | ||||
|     gutil.log('Event type: ' + event.event); // added, changed, or deleted
 | ||||
|  | ||||
| @ -36,11 +36,10 @@ | ||||
|     "cross-spawn": "^4.0.0", | ||||
|     "del": "^2.2.0", | ||||
|     "dgeni": "^0.4.0", | ||||
|     "dgeni-packages": "^0.13.1", | ||||
|     "dgeni-packages": "^0.15.2", | ||||
|     "diff": "^2.1.3", | ||||
|     "fs-extra": "^0.30.0", | ||||
|     "globby": "^4.0.0", | ||||
|     "grunt-sass": "^1.2.0", | ||||
|     "gulp": "^3.5.6", | ||||
|     "gulp-env": "0.4.0", | ||||
|     "gulp-sass": "^2.3.2", | ||||
| @ -49,7 +48,7 @@ | ||||
|     "gulp-tslint": "^5.0.0", | ||||
|     "gulp-util": "^3.0.6", | ||||
|     "gulp-watch": "^4.3.4", | ||||
|     "harp": "^0.20.3", | ||||
|     "harp": "0.21.0-pre.0", | ||||
|     "html2jade": "^0.8.4", | ||||
|     "indent-string": "^2.1.0", | ||||
|     "jasmine-core": "^2.3.4", | ||||
|  | ||||
| @ -5,7 +5,7 @@ version: 0.0.1 | ||||
| environment: | ||||
|   sdk: '>=1.13.0 <2.0.0' | ||||
| dependencies: | ||||
|   angular2: 2.0.0-beta.20 | ||||
|   angular2: 2.0.0-beta.21 | ||||
|   browser: ^0.10.0 | ||||
|   dart_to_js_script_rewriter: ^1.0.1 | ||||
| transformers: | ||||
|  | ||||
| @ -5,7 +5,7 @@ version: 0.0.1 | ||||
| environment: | ||||
|   sdk: '>=1.13.0 <2.0.0' | ||||
| dependencies: | ||||
|   angular2: 2.0.0-beta.20 | ||||
|   angular2: 2.0.0-beta.21 | ||||
|   browser: ^0.10.0 | ||||
|   dart_to_js_script_rewriter: ^1.0.1 | ||||
| transformers: | ||||
|  | ||||
| @ -5,7 +5,7 @@ version: 0.0.1 | ||||
| environment: | ||||
|   sdk: '>=1.13.0 <2.0.0' | ||||
| dependencies: | ||||
|   angular2: 2.0.0-beta.20 | ||||
|   angular2: 2.0.0-beta.21 | ||||
|   browser: ^0.10.0 | ||||
|   dart_to_js_script_rewriter: ^1.0.1 | ||||
| transformers: | ||||
|  | ||||
| @ -5,7 +5,7 @@ version: 0.0.1 | ||||
| environment: | ||||
|   sdk: '>=1.13.0 <2.0.0' | ||||
| dependencies: | ||||
|   angular2: 2.0.0-beta.20 | ||||
|   angular2: 2.0.0-beta.21 | ||||
|   browser: ^0.10.0 | ||||
|   dart_to_js_script_rewriter: ^1.0.1 | ||||
| transformers: | ||||
|  | ||||
| @ -5,7 +5,7 @@ version: 0.0.1 | ||||
| environment: | ||||
|   sdk: '>=1.13.0 <2.0.0' | ||||
| dependencies: | ||||
|   angular2: 2.0.0-beta.20 | ||||
|   angular2: 2.0.0-beta.21 | ||||
|   browser: ^0.10.0 | ||||
|   dart_to_js_script_rewriter: ^1.0.1 | ||||
| transformers: | ||||
|  | ||||
| @ -5,7 +5,7 @@ version: 0.0.1 | ||||
| environment: | ||||
|   sdk: '>=1.13.0 <2.0.0' | ||||
| dependencies: | ||||
|   angular2: 2.0.0-beta.20 | ||||
|   angular2: 2.0.0-beta.21 | ||||
|   browser: ^0.10.0 | ||||
|   dart_to_js_script_rewriter: ^1.0.1 | ||||
| transformers: | ||||
|  | ||||
| @ -5,7 +5,7 @@ version: 0.0.1 | ||||
| environment: | ||||
|   sdk: '>=1.13.0 <2.0.0' | ||||
| dependencies: | ||||
|   angular2: 2.0.0-beta.20 | ||||
|   angular2: 2.0.0-beta.21 | ||||
|   browser: ^0.10.0 | ||||
|   dart_to_js_script_rewriter: ^1.0.1 | ||||
| transformers: | ||||
|  | ||||
| @ -1,6 +1,4 @@ | ||||
| // #docregion | ||||
| import 'dart:convert'; | ||||
| 
 | ||||
| import 'package:angular2/core.dart'; | ||||
| 
 | ||||
| class Hero { | ||||
| @ -23,7 +21,7 @@ class Hero { | ||||
|       '.hero {background: LightYellow; padding: 8px; margin-top: 8px}', | ||||
|       'p {background: Yellow; padding: 8px; margin-top: 8px}' | ||||
|     ]) | ||||
| class DoCheckComponent implements DoCheck, OnChanges { | ||||
| class DoCheckComponent implements DoCheck { | ||||
|   @Input() | ||||
|   Hero hero; | ||||
|   @Input() | ||||
| @ -72,16 +70,6 @@ class DoCheckComponent implements DoCheck, OnChanges { | ||||
|   } | ||||
|   // #enddocregion ng-do-check | ||||
| 
 | ||||
|   // Copied from OnChangesComponent | ||||
|   ngOnChanges(Map<String, SimpleChange> changes) { | ||||
|     changes.forEach((String propName, SimpleChange change) { | ||||
|       String cur = JSON.encode(change.currentValue); | ||||
|       String prev = | ||||
|           change.isFirstChange() ? "{}" : JSON.encode(change.previousValue); | ||||
|       changeLog.add('$propName: currentValue = $cur, previousValue = $prev'); | ||||
|     }); | ||||
|   } | ||||
| 
 | ||||
|   void reset() { | ||||
|     changeDetected = true; | ||||
|     changeLog.clear(); | ||||
|  | ||||
| @ -5,7 +5,7 @@ version: 0.0.1 | ||||
| environment: | ||||
|   sdk: '>=1.13.0 <2.0.0' | ||||
| dependencies: | ||||
|   angular2: 2.0.0-beta.20 | ||||
|   angular2: 2.0.0-beta.21 | ||||
|   browser: ^0.10.0 | ||||
|   dart_to_js_script_rewriter: ^1.0.1 | ||||
| transformers: | ||||
|  | ||||
| @ -5,7 +5,7 @@ version: 0.0.1 | ||||
| environment: | ||||
|   sdk: '>=1.13.0 <2.0.0' | ||||
| dependencies: | ||||
|   angular2: 2.0.0-beta.20 | ||||
|   angular2: 2.0.0-beta.21 | ||||
|   browser: ^0.10.0 | ||||
|   dart_to_js_script_rewriter: ^1.0.1 | ||||
| transformers: | ||||
|  | ||||
| @ -5,7 +5,7 @@ version: 0.0.1 | ||||
| environment: | ||||
|   sdk: '>=1.13.0 <2.0.0' | ||||
| dependencies: | ||||
|   angular2: 2.0.0-beta.20 | ||||
|   angular2: 2.0.0-beta.21 | ||||
|   browser: ^0.10.0 | ||||
|   dart_to_js_script_rewriter: ^1.0.1 | ||||
| transformers: | ||||
|  | ||||
| @ -9,10 +9,10 @@ | ||||
| 
 | ||||
|     <!-- 1. Load libraries --> | ||||
|     <!-- #docregion libraries --> | ||||
|     <!-- #docregion ie-polyfills --> | ||||
|     <!-- #docregion polyfills --> | ||||
|      <!-- Polyfill(s) for older browsers --> | ||||
|     <script src="node_modules/core-js/client/shim.min.js"></script> | ||||
|     <!-- #enddocregion ie-polyfills --> | ||||
|     <!-- #enddocregion polyfills --> | ||||
| 
 | ||||
|     <script src="node_modules/zone.js/dist/zone.js"></script> | ||||
|     <script src="node_modules/reflect-metadata/Reflect.js"></script> | ||||
|  | ||||
| @ -5,7 +5,7 @@ version: 0.0.1 | ||||
| environment: | ||||
|   sdk: '>=1.13.0 <2.0.0' | ||||
| dependencies: | ||||
|   angular2: 2.0.0-beta.20 | ||||
|   angular2: 2.0.0-beta.21 | ||||
|   browser: ^0.10.0 | ||||
|   dart_to_js_script_rewriter: ^1.0.1 | ||||
|   http: ^0.11.3+3 | ||||
|  | ||||
| @ -5,7 +5,7 @@ version: 0.0.1 | ||||
| environment: | ||||
|   sdk: '>=1.13.0 <2.0.0' | ||||
| dependencies: | ||||
|   angular2: 2.0.0-beta.20 | ||||
|   angular2: 2.0.0-beta.21 | ||||
|   browser: ^0.10.0 | ||||
|   dart_to_js_script_rewriter: ^1.0.1 | ||||
| transformers: | ||||
|  | ||||
| @ -5,7 +5,7 @@ version: 0.0.1 | ||||
| environment: | ||||
|   sdk: '>=1.13.0 <2.0.0' | ||||
| dependencies: | ||||
|   angular2: 2.0.0-beta.20 | ||||
|   angular2: 2.0.0-beta.21 | ||||
|   browser: ^0.10.0 | ||||
|   dart_to_js_script_rewriter: ^1.0.1 | ||||
| transformers: | ||||
|  | ||||
| @ -5,7 +5,7 @@ version: 0.0.1 | ||||
| environment: | ||||
|   sdk: '>=1.13.0 <2.0.0' | ||||
| dependencies: | ||||
|   angular2: 2.0.0-beta.20 | ||||
|   angular2: 2.0.0-beta.21 | ||||
|   browser: ^0.10.0 | ||||
|   dart_to_js_script_rewriter: ^1.0.1 | ||||
| transformers: | ||||
|  | ||||
| @ -5,7 +5,7 @@ version: 0.0.1 | ||||
| environment: | ||||
|   sdk: '>=1.13.0 <2.0.0' | ||||
| dependencies: | ||||
|   angular2: 2.0.0-beta.20 | ||||
|   angular2: 2.0.0-beta.21 | ||||
|   browser: ^0.10.0 | ||||
|   dart_to_js_script_rewriter: ^1.0.1 | ||||
| transformers: | ||||
|  | ||||
| @ -5,7 +5,7 @@ version: 0.0.1 | ||||
| environment: | ||||
|   sdk: '>=1.13.0 <2.0.0' | ||||
| dependencies: | ||||
|   angular2: 2.0.0-beta.20 | ||||
|   angular2: 2.0.0-beta.21 | ||||
|   browser: ^0.10.0 | ||||
|   dart_to_js_script_rewriter: ^1.0.1 | ||||
| transformers: | ||||
|  | ||||
| @ -5,7 +5,7 @@ version: 0.0.1 | ||||
| environment: | ||||
|   sdk: '>=1.13.0 <2.0.0' | ||||
| dependencies: | ||||
|   angular2: 2.0.0-beta.20 | ||||
|   angular2: 2.0.0-beta.21 | ||||
|   browser: ^0.10.0 | ||||
|   dart_to_js_script_rewriter: ^1.0.1 | ||||
| transformers: | ||||
|  | ||||
| @ -5,7 +5,7 @@ version: 0.0.1 | ||||
| environment: | ||||
|   sdk: '>=1.13.0 <2.0.0' | ||||
| dependencies: | ||||
|   angular2: 2.0.0-beta.20 | ||||
|   angular2: 2.0.0-beta.21 | ||||
|   browser: ^0.10.0 | ||||
|   dart_to_js_script_rewriter: ^1.0.1 | ||||
| transformers: | ||||
|  | ||||
| @ -7,7 +7,7 @@ environment: | ||||
|   sdk: '>=1.13.0 <2.0.0' | ||||
|   # #docregion additions | ||||
| dependencies: | ||||
|   angular2: 2.0.0-beta.20 | ||||
|   angular2: 2.0.0-beta.21 | ||||
|   # #enddocregion additions | ||||
|   browser: ^0.10.0 | ||||
|   dart_to_js_script_rewriter: ^1.0.1 | ||||
|  | ||||
| @ -5,7 +5,7 @@ version: 0.0.1 | ||||
| environment: | ||||
|   sdk: '>=1.13.0 <2.0.0' | ||||
| dependencies: | ||||
|   angular2: 2.0.0-beta.20 | ||||
|   angular2: 2.0.0-beta.21 | ||||
|   browser: ^0.10.0 | ||||
|   dart_to_js_script_rewriter: ^1.0.1 | ||||
| transformers: | ||||
|  | ||||
| @ -3,7 +3,7 @@ | ||||
|     "icon": "home", | ||||
|     "title": "Angular Docs", | ||||
|     "menuTitle": "Docs Home", | ||||
|     "banner": "Welcome to <b>angular.io/dart</b>! The current Angular 2 Dart release is <b>beta.20</b>. Consult the <a href='https://github.com/dart-lang/angular2/blob/master/CHANGELOG.md' target='_blank'>Change Log</a> about recent enhancements, fixes, and breaking changes." | ||||
|     "banner": "Welcome to <b>angular.io/dart</b>! The current Angular 2 Dart release is <b>beta.21</b>. Consult the <a href='https://github.com/dart-lang/angular2/blob/master/CHANGELOG.md' target='_blank'>Change Log</a> about recent enhancements, fixes, and breaking changes." | ||||
|   }, | ||||
| 
 | ||||
|   "quickstart": { | ||||
| @ -38,7 +38,7 @@ | ||||
| 
 | ||||
|   "cheatsheet": { | ||||
|     "title": "Angular Cheat Sheet", | ||||
|     "intro": "A quick guide to Angular syntax.", | ||||
|     "intro": "A quick guide to Angular syntax. (Content is provisional and may change.)", | ||||
|     "reference": false | ||||
|   }, | ||||
| 
 | ||||
|  | ||||
| @ -1,9 +1,4 @@ | ||||
| - var base = current.path[4] ? '.' : './guide'; | ||||
| .banner.grid-fluid | ||||
|   .alert.is-important | ||||
|     :marked | ||||
|       This cheat sheet is provisional and subject to change. | ||||
| 
 | ||||
| article(class="l-content-small grid-fluid docs-content") | ||||
|   .cheatsheet | ||||
|     ngio-cheatsheet(src= base + '/cheatsheet.json') | ||||
| .l-content-small.grid-fluid.docs-content.cheatsheet | ||||
|   ngio-cheatsheet(src= base + '/cheatsheet.json') | ||||
|  | ||||
| @ -59,7 +59,7 @@ | ||||
| 
 | ||||
|   "cheatsheet": { | ||||
|     "title": "Angular Cheat Sheet", | ||||
|     "intro": "A quick guide to Angular syntax.", | ||||
|     "intro": "A quick guide to Angular syntax. (Content is provisional and may change.)", | ||||
|     "nextable": true, | ||||
|     "basics": true | ||||
|   }, | ||||
| @ -87,6 +87,11 @@ | ||||
|     "intro": "Attribute directives attach behavior to elements." | ||||
|   }, | ||||
| 
 | ||||
|   "browser-support": { | ||||
|     "title": "Browser support", | ||||
|     "intro": "Browser support and polyfills guide." | ||||
|   }, | ||||
| 
 | ||||
|   "component-styles": { | ||||
|     "title": "Component Styles", | ||||
|     "intro": "Learn how to apply CSS styles to components." | ||||
|  | ||||
							
								
								
									
										1
									
								
								public/docs/dart/latest/guide/browser-support.jade
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								public/docs/dart/latest/guide/browser-support.jade
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1 @@ | ||||
| != partial("../../../_includes/_ts-temp") | ||||
| @ -1 +1 @@ | ||||
| != partial("../cheatsheet") | ||||
| extends ../cheatsheet | ||||
|  | ||||
| @ -30,7 +30,7 @@ block package-and-config-files | ||||
|     packages as dependencies, as well as the `angular2` transformer. | ||||
|     It can also specify other packages and transformers for the app to use, | ||||
|     such as [dart_to_js_script_rewriter](https://pub.dartlang.org/packages/dart_to_js_script_rewriter). | ||||
|     Angular 2 is still changing, so provide an exact version: **2.0.0-beta.20**. | ||||
|     Angular 2 is still changing, so provide an exact version: **2.0.0-beta.21**. | ||||
| 
 | ||||
|     [pubspec]: https://www.dartlang.org/tools/pub/pubspec.html | ||||
| 
 | ||||
|  | ||||
| @ -38,7 +38,7 @@ | ||||
| 
 | ||||
|   "cheatsheet": { | ||||
|     "title": "Angular Cheat Sheet", | ||||
|     "intro": "A quick guide to Angular syntax.", | ||||
|     "intro": "A quick guide to Angular syntax. (Content is provisional and may change.)", | ||||
|     "reference": false | ||||
|   }, | ||||
| 
 | ||||
|  | ||||
| @ -1,5 +1,4 @@ | ||||
| - var base = current.path[4] ? '.' : './guide'; | ||||
| 
 | ||||
| article(class="l-content-small grid-fluid docs-content") | ||||
|   .cheatsheet | ||||
|     ngio-cheatsheet(src= base + '/cheatsheet.json') | ||||
| .l-content-small.grid-fluid.docs-content.cheatsheet | ||||
|   ngio-cheatsheet(src= base + '/cheatsheet.json') | ||||
|  | ||||
| @ -52,7 +52,7 @@ | ||||
| 
 | ||||
|   "cheatsheet": { | ||||
|     "title": "Angular Cheat Sheet", | ||||
|     "intro": "A quick guide to Angular syntax.", | ||||
|     "intro": "A quick guide to Angular syntax. (Content is provisional and may change.)", | ||||
|     "nextable": true, | ||||
|     "basics": true | ||||
|   }, | ||||
| @ -74,6 +74,11 @@ | ||||
|     "intro": "Attribute directives attach behavior to elements." | ||||
|   }, | ||||
| 
 | ||||
|   "browser-support": { | ||||
|     "title": "Browser support", | ||||
|     "intro": "Browser support and polyfills guide." | ||||
|   }, | ||||
| 
 | ||||
|   "component-styles": { | ||||
|     "title": "Component Styles", | ||||
|     "intro": "Learn how to apply CSS styles to components." | ||||
|  | ||||
							
								
								
									
										1
									
								
								public/docs/js/latest/guide/browser-support.jade
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								public/docs/js/latest/guide/browser-support.jade
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1 @@ | ||||
| != partial("../../../_includes/_ts-temp") | ||||
| @ -1 +1 @@ | ||||
| != partial("../cheatsheet") | ||||
| extends ../cheatsheet | ||||
|  | ||||
| @ -1,8 +1,4 @@ | ||||
| - var base = current.path[4] ? '.' : './guide'; | ||||
| .banner | ||||
|   p.text-body This cheat sheet is provisional and may change. Angular 2 is currently in Beta. | ||||
|   p.text-body 本小抄是临时的,将来可能改变。Angular 2目前在候选版本阶段。 | ||||
| 
 | ||||
| article(class="l-content-small grid-fluid docs-content") | ||||
|   .cheatsheet | ||||
|     ngio-cheatsheet(src= base + '/cheatsheet-cn.json') | ||||
| .l-content-small.grid-fluid.docs-content.cheatsheet | ||||
|   ngio-cheatsheet(src= base + '/cheatsheet.json') | ||||
|  | ||||
| @ -536,22 +536,22 @@ block includes | ||||
|   ## ES 2015 | ||||
| .l-sub-section | ||||
|   :marked | ||||
|     Short hand for "[ECMAScript 2015](#ecmascript=2015)". | ||||
|     Short hand for [ECMAScript](#ecmascript) 2015. | ||||
| 
 | ||||
|     [ECMAScript 2015](#ecmascript=2015)的缩写。 | ||||
|     [ECMAScript](#ecmascript) 2015的缩写。 | ||||
|      | ||||
| :marked | ||||
|   ## ES6 | ||||
| .l-sub-section | ||||
|   :marked | ||||
|     Short hand for "[ECMAScript 2015](#ecmascript=2015)". | ||||
|     Short hand for [ECMAScript](#ecmascript) 2015. | ||||
| 
 | ||||
|     [ECMAScript 2015](#ecmascript=2015)的简写。 | ||||
|     [ECMAScript](#ecmascript) 2015的简写。 | ||||
| :marked | ||||
|   ## ES5 | ||||
| .l-sub-section | ||||
|   :marked | ||||
|     Short hand for "ECMAScript 5", the version of JavaScript run by most modern browsers. | ||||
|     Short hand for [ECMAScript](#ecmascript) 5, the version of JavaScript run by most modern browsers. | ||||
|     See [ECMAScript](#ecmascript). | ||||
| 
 | ||||
|     “ECMAScript 5”的简写,大部分现代浏览器使用的JavaScript版本。参见[ECMAScript](#ecmascript)。 | ||||
| @ -1125,7 +1125,7 @@ a#snake-case | ||||
|   ## TypeScript | ||||
| .l-sub-section | ||||
|   :marked | ||||
|     A version of JavaScript that supports most [ECMAScript 2015](#ecmascript=2015) | ||||
|     A version of JavaScript that supports most [ECMAScript](#ecmascript) 2015 | ||||
|     language features and many features that may arrive in future versions | ||||
|     of JavaScript such as [Decorators](#decorator). | ||||
| 
 | ||||
|  | ||||
| @ -86,6 +86,11 @@ | ||||
|     "intro": "属性型指令把行为添加到现有元素上。" | ||||
|   }, | ||||
| 
 | ||||
|   "browser-support": { | ||||
|     "title": "Browser support", | ||||
|     "intro": "Browser support and polyfills guide." | ||||
|   }, | ||||
| 
 | ||||
|   "component-styles": { | ||||
|     "title": "组件样式", | ||||
|     "intro": "学习如何给组件应用CSS样式。" | ||||
|  | ||||
							
								
								
									
										204
									
								
								public/docs/ts/latest/guide/browser-support.jade
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										204
									
								
								public/docs/ts/latest/guide/browser-support.jade
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,204 @@ | ||||
| block includes | ||||
|   include ../_util-fns | ||||
|   - var _at_angular = '@angular' | ||||
| 
 | ||||
| :marked | ||||
|   # Browser support #   | ||||
|   Angular supports most recent browsers. This includes the following specific versions: | ||||
| 
 | ||||
| table | ||||
|   tr | ||||
|     th Chrome | ||||
|     th Firefox | ||||
|     th Edge | ||||
|     th IE | ||||
|     th Safari | ||||
|     th iOS | ||||
|     th Android | ||||
|     th IE mobile | ||||
|   tr | ||||
|     td latest | ||||
|     td latest | ||||
|     td 14 | ||||
|     td 11 | ||||
|     td 9 | ||||
|     td 9 | ||||
|     td Marshmallow (6.0) | ||||
|     td 11 | ||||
|   tr | ||||
|     td | ||||
|     td | ||||
|     td 13 | ||||
|     td 10 | ||||
|     td 8 | ||||
|     td 8 | ||||
|     td Lollipop<br>(5.0, 5.1) | ||||
|     td | ||||
|   tr | ||||
|     td | ||||
|     td | ||||
|     td | ||||
|     td 9 | ||||
|     td 7 | ||||
|     td 7 | ||||
|     td KitKat<br>(4.4) | ||||
|     td | ||||
|   tr | ||||
|     td | ||||
|     td | ||||
|     td | ||||
|     td | ||||
|     td | ||||
|     td | ||||
|     td Jelly Bean<br>(4.1, 4.2, 4.3) | ||||
|     td | ||||
|      | ||||
|      | ||||
| .l-sub-section | ||||
|   :marked | ||||
|     Angular's continuous integration process runs unit tests of the framework on all of these browsers for every pull request,  | ||||
|     using <a href="https://saucelabs.com/" target="_blank">SauceLabs</a> and  | ||||
|     <a href="https://www.browserstack.com" target="_blank">Browserstack</a>. | ||||
| 
 | ||||
| :marked | ||||
|   # Polyfills # | ||||
|   Angular is built on the latest standards of the web platform. | ||||
|   Targeting such a wide range of browsers is challenging because they do not support all features of modern browsers. | ||||
|    | ||||
|   You compensate by loading polyfill scripts ("polyfills") on the host web page (`index.html`) | ||||
|   that implement missing features in JavaScript. | ||||
| +makeExample('quickstart/ts/index.html', 'polyfills')(format='.') | ||||
| :marked | ||||
|   A particular browser may require at least one polyfill to run _any_ Angular application.  | ||||
|   You may need additional polyfills for specific features. | ||||
| 
 | ||||
|   The tables below will help you determine which polyfills to load, depending on the browsers you target and the features you use. | ||||
|    | ||||
| .alert.is-important | ||||
|   :marked | ||||
|     The suggested polyfills are the ones we know will run full Angular applications. | ||||
|     You may need additional polyfills to support features not covered by this list. | ||||
|     Note that polyfills cannot magically transform an old, slow browser into a modern, fast one. | ||||
|    | ||||
| :marked | ||||
|   ## Mandatory polyfills ## | ||||
|   These are the polyfills required to run an Angular application on each supported browser: | ||||
|    | ||||
| table | ||||
|   tr(style="vertical-align: top")  | ||||
|     th Browsers (desktop & mobile) | ||||
|     th Polyfills required | ||||
|   tr(style="vertical-align: top")  | ||||
|     td Chrome, Firefox, Edge, Safari 9+ | ||||
|     td None | ||||
|   tr(style="vertical-align: top")  | ||||
|     td Safari 7 & 8, IE10 & 11, Android 4.1+ | ||||
|     td | ||||
|       :marked | ||||
|         [ES6](#core-es6) | ||||
|   tr(style="vertical-align: top")  | ||||
|     td IE9 | ||||
|     td | ||||
|       :marked | ||||
|         [ES6<br>classList](#classlist) | ||||
| 
 | ||||
| :marked | ||||
|   ## Optional browser features to polyfill ## | ||||
|   Some features of Angular may require additional polyfills. | ||||
|    | ||||
|   For example, the animations library relies on the standard web animation API, which is only available in Chrome and Firefox today. | ||||
|   You'll need a polyfill to use animations in other browsers. | ||||
|    | ||||
|   Here are the features which may require additional polyfills: | ||||
| 
 | ||||
| table | ||||
|   tr(style="vertical-align: top")  | ||||
|     th Feature | ||||
|     th Polyfill | ||||
|     th(style="width: 50%")  Browsers (desktop & mobile) | ||||
| 
 | ||||
|   tr(style="vertical-align: top")  | ||||
|     td | ||||
|       a(href="./animations.html") Animations | ||||
|     td | ||||
|       :marked | ||||
|         [Web Animations](#web-animations) | ||||
|     td All but Chrome and Firefox<br>Not supported in IE9 | ||||
|   tr(style="vertical-align: top")  | ||||
|     td | ||||
|       a(href="../api/common/index/DatePipe-class.html" target="_blank") Date | ||||
|       span ,   | ||||
|       a(href="../api/common/index/CurrencyPipe-class.html" target="_blank") currency | ||||
|       span ,  | ||||
|       a(href="../api/common/index/DecimalPipe-class.html" target="_blank") decimal | ||||
|       span  and  | ||||
|       a(href="../api/common/index/PercentPipe-class.html" target="_blank") percent | ||||
|       span  pipes | ||||
|     td | ||||
|       :marked | ||||
|         [Intl API](#intl) | ||||
|     td All but Chrome, Firefox, Edge and IE11 | ||||
|   tr(style="vertical-align: top")  | ||||
|     td  | ||||
|       a(href="../api/common/index/NgClass-directive.html" target="_blank") NgClass | ||||
|       span  on SVG elements | ||||
|     td  | ||||
|       :marked | ||||
|         [classList](#classlist) | ||||
|     td IE10, IE11 | ||||
|   tr(style="vertical-align: top")  | ||||
|     td | ||||
|       a(href="./server-communication.html") Http | ||||
|       span  when sending and receiving binary data | ||||
|     td  | ||||
|       :marked | ||||
|         [Typed Array](#typedarray) <br>[Blob](#blob)<br>[FormData](#formdata) | ||||
|     td IE 9 | ||||
| 
 | ||||
| :marked | ||||
|   ## Suggested polyfills ## | ||||
|   Below are the polyfills which are used to test the framework itself. They are a good starting point for an application.  | ||||
| 
 | ||||
| table | ||||
|   tr | ||||
|     th Polyfill | ||||
|     th Licence | ||||
|     th Size* | ||||
|   tr | ||||
|     td | ||||
|       a#core-es6(href="https://github.com/zloirock/core-js" target="_blank") ES6 | ||||
|     td MIT | ||||
|     td 27.4KB | ||||
|   tr | ||||
|     td | ||||
|      a#classlist(href="https://github.com/eligrey/classList.js" target="_blank") classList | ||||
|     td Public domain | ||||
|     td 1KB | ||||
|   tr | ||||
|     td | ||||
|      a#intl(href="https://github.com/andyearnshaw/Intl.js" target="_blank") Intl | ||||
|     td MIT / Unicode licence | ||||
|     td 13.5KB | ||||
|   tr | ||||
|     td  | ||||
|       a#web-animations(href="https://github.com/web-animations/web-animations-js" target="_blank") Web Animations | ||||
|     td Apache | ||||
|     td 14.8KB | ||||
|   tr | ||||
|     td | ||||
|       a#typedarray(href="https://github.com/inexorabletash/polyfill/blob/master/typedarray.js" target="_blank") Typed Array | ||||
|     td MIT | ||||
|     td 4KB | ||||
|   tr | ||||
|     td  | ||||
|       a#blob(href="https://github.com/eligrey/Blob.js" target="_blank") Blob | ||||
|     td MIT | ||||
|     td 1.3KB | ||||
|   tr | ||||
|     td  | ||||
|       a#formdata(href="https://github.com/francois2metz/html5-formdata" target="_blank") FormData | ||||
|     td MIT | ||||
|     td 0.4KB | ||||
| 
 | ||||
| :marked | ||||
|   * Figures are for minified and gzipped code, computed with the <a href="http://closure-compiler.appspot.com/home" target="_blank">closure compiler</a> | ||||
| @ -1 +1 @@ | ||||
| != partial("../cheatsheet") | ||||
| extends ../cheatsheet | ||||
|  | ||||
| @ -1380,9 +1380,8 @@ code-example(format="." language="bash"). | ||||
|   We too can call that `ngOnInit` method in our tests if we wish ... after taking control of the injected | ||||
|   `HeroService` and (perhaps) mocking it. | ||||
| 
 | ||||
| <a name="browser-url-styles"></a> | ||||
| <a id="location-strategy"></a> | ||||
| .l-main-section | ||||
| a#browser-url-styles | ||||
| .l-main-section#location-strategy | ||||
| :marked | ||||
|   ## Appendix: *LocationStrategy* and browser URL styles | ||||
| 
 | ||||
|  | ||||
| @ -3389,11 +3389,8 @@ a#fragment | ||||
| 
 | ||||
|   在获得了已注入的`HeroService`实例并(可能)做好模拟(Mock)之后,我们可以随时在测试中调用`ngOnInit`方法。 | ||||
| 
 | ||||
| <a name="browser-url-styles"></a> | ||||
| <a id="location-strategy"></a> | ||||
| 
 | ||||
| .l-main-section | ||||
| 
 | ||||
| a#browser-url-styles | ||||
| .l-main-section#location-strategy | ||||
| :marked | ||||
|   ## Appendix: *LocationStrategy* and browser URL styles | ||||
| 
 | ||||
|  | ||||
| @ -315,11 +315,11 @@ block install-packages | ||||
|     application, you'd likely import [`FormsModule`](../latest/api/forms/index/FormsModule-class | ||||
|     .html) as well as [`RouterModule`](../latest/api/router/index/RouterModule-class.html) and | ||||
|     [`HttpModule`](../latest/api/http/index/HttpModule-class.html). These are introduced in the | ||||
|     [Tour of Heroes Tutorial](../tutorial/). | ||||
|     [Tour of Heroes Tutorial](./tutorial/). | ||||
|      | ||||
|     QuickStart应用不做别的,也就先不需要其他模块。在真实的应用中,我们可能还得导入[`FormsModule`](../latest/api/forms/index/FormsModule-class | ||||
|     .html)、[`RouterModule`](../latest/api/router/index/RouterModule-class.html)和 | ||||
|     [`HttpModule`](../latest/api/http/index/HttpModule-class.html)。这些会在[英雄指南教程](../tutorial/)中引入。 | ||||
|     [`HttpModule`](../latest/api/http/index/HttpModule-class.html)。这些会在[英雄指南教程](./tutorial/)中引入。 | ||||
| 
 | ||||
| 
 | ||||
| .l-main-section | ||||
|  | ||||
| @ -8,6 +8,10 @@ | ||||
|     content: 'D'; | ||||
|     background: #db4437; | ||||
|   } | ||||
|   &.pipe:before { | ||||
|     content: 'P'; | ||||
|     background: #78909C; | ||||
|   } | ||||
|   &.class:before { | ||||
|     content: 'C'; | ||||
|     background: #4285f4; | ||||
|  | ||||
| @ -31,6 +31,7 @@ angularIO.directive('apiList', function () { | ||||
|       $ctrl.apiTypes = [ | ||||
|         { cssClass: 'stable', title: 'Stable', matches: ['stable']}, | ||||
|         { cssClass: 'directive', title: 'Directive', matches: ['directive'] }, | ||||
|         { cssClass: 'pipe', title: 'Pipe', matches: ['pipe'] }, | ||||
|         { cssClass: 'decorator', title: 'Decorator', matches: ['decorator'] }, | ||||
|         { cssClass: 'class', title: 'Class', matches: ['class'] }, | ||||
|         { cssClass: 'interface', title: 'Interface', matches: ['interface'] }, | ||||
|  | ||||
| @ -4,7 +4,7 @@ version: 0.0.1 | ||||
| environment: | ||||
|   sdk: '>=1.13.0 <2.0.0' | ||||
| dependencies: | ||||
|   angular2: 2.0.0-beta.20 | ||||
|   angular2: 2.0.0-beta.21 | ||||
|   browser: ^0.10.0 | ||||
|   dart_to_js_script_rewriter: ^1.0.1 | ||||
| transformers: | ||||
|  | ||||
| @ -16,7 +16,6 @@ module.exports = new Package('angular.io', [basePackage, targetPackage, cheatshe | ||||
| .factory(require('./services/renderMarkdown')) | ||||
| .processor(require('./processors/addJadeDataDocsProcessor')) | ||||
| .processor(require('./processors/filterUnwantedDecorators')) | ||||
| .processor(require('./processors/extractDirectiveClasses')) | ||||
| .processor(require('./processors/matchUpDirectiveDecorators')) | ||||
| .processor(require('./processors/filterMemberDocs')) | ||||
| 
 | ||||
| @ -100,7 +99,7 @@ module.exports = new Package('angular.io', [basePackage, targetPackage, cheatshe | ||||
| }) | ||||
| 
 | ||||
| 
 | ||||
| .config(function(readFilesProcessor, generateNavigationDoc, createOverviewDump) { | ||||
| .config(function(readFilesProcessor, generateNavigationDoc) { | ||||
|   // Clear out unwanted processors
 | ||||
|   generateNavigationDoc.$enabled = false; | ||||
| }) | ||||
|  | ||||
| @ -95,7 +95,7 @@ module.exports = function addJadeDataDocsProcessor() { | ||||
|               }); | ||||
| 
 | ||||
|               // Remove line breaks, there should only be one tag
 | ||||
|               howToUse = howToUseArray[0].description.replace(/(\r\n|\n|\r)/gm,""); | ||||
|               howToUse = howToUseArray[0].description.replace(/(\r\n|\n|\r)/gm," "); | ||||
|             } | ||||
| 
 | ||||
|             var whatItDoes = ''; | ||||
| @ -105,7 +105,7 @@ module.exports = function addJadeDataDocsProcessor() { | ||||
|               }); | ||||
| 
 | ||||
|               // Remove line breaks, there should only be one tag
 | ||||
|               whatItDoes = whatItDoesArray[0].description.replace(/(\r\n|\n|\r)/gm,""); | ||||
|               whatItDoes = whatItDoesArray[0].description.replace(/(\r\n|\n|\r)/gm," "); | ||||
|             } | ||||
| 
 | ||||
|             // SECURITY STATUS
 | ||||
| @ -119,7 +119,7 @@ module.exports = function addJadeDataDocsProcessor() { | ||||
|               }); | ||||
| 
 | ||||
|               // Remove line breaks, there should only be one tag
 | ||||
|               security = securityArray[0].description.replace(/(\r\n|\n|\r)/gm,""); | ||||
|               security = securityArray[0].description.replace(/(\r\n|\n|\r)/gm," "); | ||||
| 
 | ||||
|               exportDoc.showSecurityNotes = true; | ||||
|             } | ||||
|  | ||||
| @ -1,51 +0,0 @@ | ||||
| var mockPackage = require('../mocks/mockPackage'); | ||||
| var Dgeni = require('dgeni'); | ||||
| 
 | ||||
| describe('extractDirectiveClasses processor', function() { | ||||
|   var dgeni, injector, processor; | ||||
| 
 | ||||
|   beforeEach(function() { | ||||
|     dgeni = new Dgeni([mockPackage()]); | ||||
|     injector = dgeni.configureInjector(); | ||||
|     processor = injector.get('extractDirectiveClassesProcessor'); | ||||
|   }); | ||||
| 
 | ||||
|   it('should extract specified decorator arguments', function() { | ||||
|     var doc = { | ||||
|       id: 'angular2/angular2.ngFor', | ||||
|       name: 'ngFor', | ||||
|       docType: 'class', | ||||
|       decorators: [ | ||||
|         { | ||||
|           name: 'Directive', | ||||
|           arguments: ['{selector: \'[ng-for][ng-for-of]\', properties: [\'ngForOf\']}'], | ||||
|           argumentInfo: [ | ||||
|             { selector: '[ng-for][ng-for-of]', properties: ['ngForOf'] } | ||||
|           ] | ||||
|         } | ||||
|       ] | ||||
|     }; | ||||
| 
 | ||||
|     var docs = processor.$process([doc]); | ||||
| 
 | ||||
|     expect(doc).toEqual(jasmine.objectContaining({ | ||||
|       id: 'angular2/angular2.ngFor', | ||||
|       name: 'ngFor', | ||||
|       docType: 'directive', | ||||
|       decorators: [ | ||||
|         { | ||||
|           name: 'Directive', | ||||
|           arguments: ['{selector: \'[ng-for][ng-for-of]\', properties: [\'ngForOf\']}'], | ||||
|           argumentInfo: [ | ||||
|             { selector: '[ng-for][ng-for-of]', properties: ['ngForOf'] } | ||||
|           ] | ||||
|         } | ||||
|       ] | ||||
|     })); | ||||
| 
 | ||||
|     expect(doc.directiveOptions).toEqual({ | ||||
|       selector: '[ng-for][ng-for-of]', | ||||
|       properties: ['ngForOf'] | ||||
|     }); | ||||
|   }); | ||||
| }); | ||||
| @ -1,5 +1,5 @@ | ||||
| {% include "lib/githubLinks.html" -%} | ||||
| {% include "lib/paramList.html" -%} | ||||
| {% import "lib/githubLinks.html" as github -%} | ||||
| {% import "lib/paramList.html" as params -%} | ||||
| {% extends 'layout/base.template.html' -%} | ||||
| 
 | ||||
| {% block body %} | ||||
| @ -25,7 +25,7 @@ div(layout="row" layout-xs="column" class="ng-cloak") | ||||
|         pre(class="prettyprint no-bg-with-indent") | ||||
|           a(class="code-anchor" href="#{$ member.name $}-anchor") | ||||
|             code(class="code-background api-doc-code") {$ member.name | indent(6, false) | trim $} | ||||
|           code(class="api-doc-code") {$ paramList(member.parameters) | indent(8, false) | trim $}{$ returnType(member.returnType) $} | ||||
|           code(class="api-doc-code") {$ params.paramList(member.parameters) | indent(8, false) | trim $}{$ params.returnType(member.returnType) $} | ||||
|       {% endif %}{% endfor %} | ||||
|     {% endif %} | ||||
|     {% if doc.constructorDoc.name %} | ||||
| @ -34,7 +34,7 @@ div(layout="row" layout-xs="column" class="ng-cloak") | ||||
|         a(class="code-anchor" href="#constructor") | ||||
|           code(class="code-background api-doc-code") {$ doc.constructorDoc.name $} | ||||
|         code(class="api-doc-code"). | ||||
|           {$ paramList(doc.constructorDoc.parameters) | indent(8, false) | trim $} | ||||
|           {$ params.paramList(doc.constructorDoc.parameters) | indent(8, false) | trim $} | ||||
|     {% endif %} | ||||
|     {% if doc.members.length %} | ||||
|     div(layout="column") | ||||
| @ -42,7 +42,7 @@ div(layout="row" layout-xs="column" class="ng-cloak") | ||||
|         pre(class="prettyprint no-bg-with-indent") | ||||
|           a(class="code-anchor" href="#{$ member.name $}-anchor") | ||||
|             code(class="code-background api-doc-code") {$ member.name | indent(6, false) | trim $} | ||||
|           code(class="api-doc-code") {$ paramList(member.parameters) | indent(8, false) | trim $}{$ returnType(member.returnType) $} | ||||
|           code(class="api-doc-code") {$ params.paramList(member.parameters) | indent(8, false) | trim $}{$ params.returnType(member.returnType) $} | ||||
|       {% endif %}{% endfor %} | ||||
|     {% endif %} | ||||
|     p(class="selector endParens") | ||||
| @ -60,14 +60,6 @@ div(layout="row" layout-xs="column" class="row-margin ng-cloak") | ||||
| {$ doc.description | indentForMarkdown(6) | trimBlankLines $} | ||||
|     {% endif %} | ||||
| 
 | ||||
| div(layout="row" layout-xs="column" class="row-margin ng-cloak") | ||||
|   div(flex="20" flex-xs="100") | ||||
|     h2(class="h2-api-docs") Class Export | ||||
|   div(flex="80" flex-xs="100") | ||||
|     pre.prettyprint.no-bg | ||||
|       code(class="api-doc-code no-pln"). | ||||
|         export {$ doc.docType $} {$ doc.name $} | ||||
| 
 | ||||
| {%- if doc.decorators.length %} | ||||
| {% block annotations %} | ||||
| div(layout="row" layout-xs="column" class="row-margin ng-cloak") | ||||
| @ -77,7 +69,7 @@ div(layout="row" layout-xs="column" class="row-margin ng-cloak") | ||||
|     {%- for decorator in doc.decorators %} | ||||
|       pre.prettyprint.no-bg | ||||
|         code(class="api-doc-code"). | ||||
|           @{$ decorator.name $}{$ paramList(decorator.arguments) | indent(10, false) $} | ||||
|           @{$ decorator.name $}{$ params.paramList(decorator.arguments) | indent(10, false) $} | ||||
|       :marked | ||||
|       {%- if not decorator.notYetDocumented %} | ||||
|         {$ decorator.description | indentForMarkdown(8) | trimBlankLines $} | ||||
| @ -94,7 +86,7 @@ div(layout="row" layout-xs="column" class="row-margin ng-cloak") | ||||
|     a(name="constructor" class="anchor-offset") | ||||
|     pre(class="prettyprint no-bg" ng-class="{ 'anchor-focused': appCtrl.isApiDocMemberFocused('{$ doc.constructorDoc.name $}') }") | ||||
|       code(class="api-doc-code"). | ||||
|         {$ doc.constructorDoc.name $}{$ paramList(doc.constructorDoc.parameters) | indent(8, false) | trim $} | ||||
|         {$ doc.constructorDoc.name $}{$ params.paramList(doc.constructorDoc.parameters) | indent(8, false) | trim $} | ||||
|     :marked | ||||
|       {%- if not doc.constructorDoc.notYetDocumented %} | ||||
| {$ doc.constructorDoc.description | indentForMarkdown(6) | replace('### Example', '') | replace('## Example', '') | replace('# Example', '') | trimBlankLines $} | ||||
| @ -110,7 +102,7 @@ div(layout="row" layout-xs="column" class="row-margin ng-cloak") | ||||
|     a(name="{$ member.name $}-anchor" class="anchor-offset") | ||||
|     pre(class="prettyprint no-bg" ng-class="{ 'anchor-focused': appCtrl.isApiDocMemberFocused('{$ member.name $}') }") | ||||
|       code(class="api-doc-code"). | ||||
|         {$ member.name $}{$ paramList(member.parameters) | indent(8, false) | trim $}{$ returnType(member.returnType) $} | ||||
|         {$ member.name $}{$ params.paramList(member.parameters) | indent(8, false) | trim $}{$ params.returnType(member.returnType) $} | ||||
|     :marked | ||||
|       {%- if not member.notYetDocumented %} | ||||
| {$ member.description | indentForMarkdown(6) | replace('### Example', '') | replace('## Example', '') | replace('# Example', '') | trimBlankLines $} | ||||
| @ -132,7 +124,7 @@ div(layout="row" layout-xs="column" class="instance-members" class="row-margin n | ||||
|     a(name="{$ member.name $}-anchor" class="anchor-offset") | ||||
|     pre(class="prettyprint no-bg" ng-class="{ 'anchor-focused': appCtrl.isApiDocMemberFocused('{$ member.name $}') }") | ||||
|       code(class="api-doc-code"). | ||||
|         {$ member.name $}{$ paramList(member.parameters) | indent(8, false) | trim $}{$ returnType(member.returnType) $} | ||||
|         {$ member.name $}{$ params.paramList(member.parameters) | indent(8, false) | trim $}{$ params.returnType(member.returnType) $} | ||||
| 
 | ||||
|     :marked | ||||
|       {%- if not member.notYetDocumented %} | ||||
| @ -147,7 +139,7 @@ div(layout="row" layout-xs="column" class="instance-members" class="row-margin n | ||||
| {% endif %} | ||||
| 
 | ||||
| p(class="location-badge"). | ||||
|   exported from {@link {$ doc.moduleDoc.id $} {$doc.moduleDoc.id $} } | ||||
|   defined in {$ githubViewLink(doc) $} | ||||
|   exported from {@link {$ doc.moduleDoc.id $} {$doc.moduleDoc.id $} }, | ||||
|   defined in {$ github.githubViewLink(doc) $} | ||||
| 
 | ||||
| {% endblock %} | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| {% include "lib/githubLinks.html" -%} | ||||
| {% include "lib/paramList.html" -%} | ||||
| {% import "lib/githubLinks.html" as github -%} | ||||
| {% import "lib/paramList.html" as params -%} | ||||
| {% extends 'layout/base.template.html' %} | ||||
| 
 | ||||
| {% block body %} | ||||
| @ -15,17 +15,37 @@ include {$ relativePath(doc.path, '_util-fns') $} | ||||
| 
 | ||||
| div(layout="row" layout-xs="column" class="row-margin ng-cloak") | ||||
|   div(flex="20" flex-xs="100") | ||||
|     h2(class="h2-api-docs") Variable Export | ||||
|     h2(class="h2-api-docs") Description | ||||
|   div(class="code-links" flex="80" flex-xs="100") | ||||
|     pre.prettyprint.no-bg | ||||
|       code. | ||||
|         export {$ doc.name $}(options : {@link {$ doc.decoratorType $} {$ doc.decoratorType | escape $}}){$ returnType(doc.returnType) $} | ||||
|     :marked | ||||
|       {%- if not doc.notYetDocumented %} | ||||
| {$ doc.description | indentForMarkdown(6) | trimBlankLines $} | ||||
|       {% endif %} | ||||
| 
 | ||||
| {% if doc.metadataDoc and doc.metadataDoc.members.length %} | ||||
| div(layout="row" layout-xs="column" class="metadata" class="row-margin ng-cloak") | ||||
|   div(flex="20" flex-xs="100") | ||||
|     h2(class="h2-api-docs") Metadata Properties | ||||
|   div(class="code-links" flex="80" flex-xs="100") | ||||
|     {% for metadata in doc.metadataDoc.members %}{% if not metadata.internal %} | ||||
|     a(name="{$ metadata.name $}-anchor" class="anchor-offset") | ||||
|     pre(class="prettyprint no-bg" ng-class="{ 'anchor-focused': appCtrl.isApiDocMemberFocused('{$ metadata.name $}') }") | ||||
|       code(class="api-doc-code"). | ||||
|         {$ metadata.name $}{$ params.paramList(metadata.parameters) | indent(8, false) | trim $}{$ params.returnType(metadata.returnType) $} | ||||
| 
 | ||||
|     :marked | ||||
|       {%- if not metadata.notYetDocumented %} | ||||
| {$ metadata.description | indentForMarkdown(6) | replace('### Example', '') | replace('## Example', '') | replace('# Example', '') | trimBlankLines $} | ||||
|       {% endif -%} | ||||
| 
 | ||||
|     {% if not loop.last %} | ||||
|     .hr(class="hr-margin") | ||||
|     {% endif %} | ||||
| 
 | ||||
|   {% endif %}{% endfor %} | ||||
| {% endif %} | ||||
| 
 | ||||
| p.location-badge. | ||||
|   exported from {@link {$ doc.moduleDoc.id $} {$doc.moduleDoc.id $} } defined in {$ githubViewLink(doc) $} | ||||
|   exported from {@link {$ doc.moduleDoc.id $} {$doc.moduleDoc.id $} } defined in {$ github.githubViewLink(doc) $} | ||||
| 
 | ||||
| {% endblock %} | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| {% include "lib/githubLinks.html" -%} | ||||
| {% include "lib/paramList.html" -%} | ||||
| {% import "lib/githubLinks.html" as github -%} | ||||
| {% import "lib/paramList.html" as params -%} | ||||
| {% extends 'class.template.html' -%} | ||||
| 
 | ||||
| {% block annotations %} | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| {% include "lib/githubLinks.html" -%} | ||||
| {% include "lib/paramList.html" -%} | ||||
| {% import "lib/githubLinks.html" as github -%} | ||||
| {% import "lib/paramList.html" as params -%} | ||||
| {% extends 'layout/base.template.html' -%} | ||||
| 
 | ||||
| {% block body %} | ||||
| @ -19,13 +19,13 @@ div(layout="row" layout-xs="column" class="row-margin ng-cloak") | ||||
|   div(class="code-links" flex="80" flex-xs="100") | ||||
|     pre.prettyprint.no-bg | ||||
|       code. | ||||
|         export {$ doc.name $}{$ paramList(doc.parameters) | indent(8, true) | trim $}{$ returnType(doc.returnType) $} | ||||
|         export {$ doc.name $}{$ params.paramList(doc.parameters) | indent(8, true) | trim $}{$ params.returnType(doc.returnType) $} | ||||
|     :marked | ||||
|       {%- if not doc.notYetDocumented %} | ||||
| {$ doc.description | indentForMarkdown(6) | trimBlankLines $} | ||||
|       {% endif %} | ||||
| 
 | ||||
| p.location-badge. | ||||
|   exported from {@link {$ doc.moduleDoc.id $} {$doc.moduleDoc.id $} } defined in {$ githubViewLink(doc) $} | ||||
|   exported from {@link {$ doc.moduleDoc.id $} {$doc.moduleDoc.id $} } defined in {$ github.githubViewLink(doc) $} | ||||
| 
 | ||||
| {% endblock %} | ||||
| @ -1 +1,73 @@ | ||||
| {% extends 'class.template.html' %} | ||||
| {% import "lib/githubLinks.html" as github -%} | ||||
| {% import "lib/paramList.html" as params -%} | ||||
| {% extends 'layout/base.template.html' -%} | ||||
| 
 | ||||
| {% block body %} | ||||
| include {$ relativePath(doc.path, '_util-fns') $} | ||||
| 
 | ||||
| {% include "layout/_what-it-does.html" %} | ||||
| 
 | ||||
| {% include "layout/_security-notes.html" %} | ||||
| 
 | ||||
| {% include "layout/_deprecated-notes.html" %} | ||||
| 
 | ||||
| {% include "layout/_how-to-use.html" %} | ||||
| 
 | ||||
| div(layout="row" layout-xs="column" class="ng-cloak") | ||||
|   div(flex="20" flex-xs="100") | ||||
|     h2(class="h2-api-docs") Interface Overview | ||||
|   div(flex="80" flex-xs="100") | ||||
|     code(class="no-bg api-doc-code openParens") interface {$ doc.name $} { | ||||
| 
 | ||||
|     {% if doc.members.length %} | ||||
|     div(layout="column") | ||||
|       {% for member in doc.members %}{% if not member.internal %} | ||||
|         pre(class="prettyprint no-bg-with-indent") | ||||
|           a(class="code-anchor" href="#{$ member.name $}-anchor") | ||||
|             code(class="code-background api-doc-code") {$ member.name | indent(6, false) | trim $} | ||||
|           code(class="api-doc-code") {$ params.paramList(member.parameters) | indent(8, false) | trim $}{$ params.returnType(member.returnType) $} | ||||
|       {% endif %}{% endfor %} | ||||
|     {% endif %} | ||||
|     p(class="selector endParens") | ||||
|       code(class="api-doc-code no-bg") } | ||||
| 
 | ||||
| {% block additional %} | ||||
| {% endblock %} | ||||
| 
 | ||||
| div(layout="row" layout-xs="column" class="row-margin ng-cloak") | ||||
|   div(flex="20" flex-xs="100") | ||||
|     h2(class="h2-api-docs") Interface Description | ||||
|   div(class="code-links" flex="80" flex-xs="100") | ||||
|     :marked | ||||
|     {%- if doc.description.length > 2 %} | ||||
| {$ doc.description | indentForMarkdown(6) | trimBlankLines $} | ||||
|     {% endif %} | ||||
| 
 | ||||
| {% if doc.members.length %} | ||||
| div(layout="row" layout-xs="column" class="instance-members" class="row-margin ng-cloak") | ||||
|   div(flex="20" flex-xs="100") | ||||
|     h2(class="h2-api-docs") Interface Details | ||||
|   div(class="code-links" flex="80" flex-xs="100") | ||||
|     {% for member in doc.members %}{% if not member.internal %} | ||||
|     a(name="{$ member.name $}-anchor" class="anchor-offset") | ||||
|     pre(class="prettyprint no-bg" ng-class="{ 'anchor-focused': appCtrl.isApiDocMemberFocused('{$ member.name $}') }") | ||||
|       code(class="api-doc-code"). | ||||
|         {$ member.name $}{$ params.paramList(member.parameters) | indent(8, false) | trim $}{$ params.returnType(member.returnType) $} | ||||
| 
 | ||||
|     :marked | ||||
|       {%- if not member.notYetDocumented %} | ||||
| {$ member.description | indentForMarkdown(6) | replace('### Example', '') | replace('## Example', '') | replace('# Example', '') | trimBlankLines $} | ||||
|       {% endif -%} | ||||
| 
 | ||||
|     {% if not loop.last %} | ||||
|     .hr(class="hr-margin") | ||||
|     {% endif %} | ||||
| 
 | ||||
|   {% endif %}{% endfor %} | ||||
| {% endif %} | ||||
| 
 | ||||
| p(class="location-badge"). | ||||
|   exported from {@link {$ doc.moduleDoc.id $} {$doc.moduleDoc.id $} }, | ||||
|   defined in {$ github.githubViewLink(doc) $} | ||||
| 
 | ||||
| {% endblock %} | ||||
|  | ||||
| @ -3,5 +3,5 @@ https://github.com/{$ versionInfo.gitRepoInfo.owner $}/{$ versionInfo.gitRepoInf | ||||
| {%- endmacro %} | ||||
| 
 | ||||
| {% macro githubViewLink(doc) -%} | ||||
|   <a href="{$ githubHref(doc) $}">{$ doc.fileInfo.projectRelativePath $} (line {$ doc.location.start.line+1 $})</a> | ||||
| {%- endmacro %} | ||||
|   <a href="{$ githubHref(doc) $}">{$ doc.fileInfo.projectRelativePath $}</a> | ||||
| {%- endmacro %} | ||||
|  | ||||
| @ -1,9 +1,9 @@ | ||||
| {% include "lib/githubLinks.html" -%} | ||||
| {% import "lib/githubLinks.html" as github -%} | ||||
| {% extends 'layout/base.template.html' -%} | ||||
| {% block body -%} | ||||
| include {$ relativePath(doc.path, '_util-fns') $} | ||||
| p.location-badge. | ||||
|   defined in {$ githubViewLink(doc) $} | ||||
|   defined in {$ github.githubViewLink(doc) $} | ||||
| 
 | ||||
| ul | ||||
|   {% for page in doc.childPages -%} | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| {% include "lib/githubLinks.html" -%} | ||||
| {% include "lib/paramList.html" -%} | ||||
| {% import "lib/githubLinks.html" as github -%} | ||||
| {% import "lib/paramList.html" as params -%} | ||||
| <!DOCTYPE html> | ||||
| <html> | ||||
| <head> | ||||
| @ -47,21 +47,21 @@ | ||||
| 
 | ||||
|   {% for export in module.exports %} | ||||
|   <h3 {% if export.notYetDocumented %}class="not-documented"{% endif %}> | ||||
|     <a href="{$ githubHref(export) $}"> | ||||
|     <a href="{$ github.githubHref(export) $}"> | ||||
|     <code>{$ export.docType $} {$ export.name $}</code> | ||||
|     </a> | ||||
|   </h3> | ||||
|       {%- if export.constructorDoc %} | ||||
|       <h4  {% if export.constructorDoc.notYetDocumented %}class="not-documented"{% endif %}> | ||||
|         <a href="{$ githubHref(export.constructorDoc) $}"> | ||||
|         <code>{$ export.constructorDoc.name $}{$ paramList(export.constructorDoc.params) $}</code> | ||||
|         <a href="{$ github.githubHref(export.constructorDoc) $}"> | ||||
|         <code>{$ export.constructorDoc.name $}{$ params.paramList(export.constructorDoc.params) $}</code> | ||||
|         </a> | ||||
|       </h4> | ||||
|     {% endif -%} | ||||
|     {%- for member in export.members %} | ||||
|       <h4 {% if member.notYetDocumented %}class="not-documented"{% endif %}> | ||||
|         <a href="{$ githubHref(member) $}"> | ||||
|         <code>{$ member.name $}{$ paramList(member.params) $}</code> | ||||
|         <a href="{$ github.githubHref(member) $}"> | ||||
|         <code>{$ member.name $}{$ params.paramList(member.params) $}</code> | ||||
|         </a> | ||||
|       </h4> | ||||
|     {% endfor %} | ||||
|  | ||||
| @ -0,0 +1,29 @@ | ||||
| {% import "lib/githubLinks.html" as github -%} | ||||
| {% import "lib/paramList.html" as params -%} | ||||
| {% extends 'layout/base.template.html' -%} | ||||
| 
 | ||||
| {% block body %} | ||||
| include {$ relativePath(doc.path, '_util-fns') $} | ||||
| 
 | ||||
| {% include "layout/_what-it-does.html" %} | ||||
| 
 | ||||
| {% include "layout/_security-notes.html" %} | ||||
| 
 | ||||
| {% include "layout/_deprecated-notes.html" %} | ||||
| 
 | ||||
| {% include "layout/_how-to-use.html" %} | ||||
| 
 | ||||
| div(layout="row" layout-xs="column" class="row-margin ng-cloak") | ||||
|   div(flex="20" flex-xs="100") | ||||
|     h2(class="h2-api-docs") Description | ||||
|   div(class="code-links" flex="80" flex-xs="100") | ||||
|     :marked | ||||
|     {%- if doc.description.length > 2 %} | ||||
| {$ doc.description | indentForMarkdown(6) | trimBlankLines $} | ||||
|     {% endif %} | ||||
| 
 | ||||
| p(class="location-badge"). | ||||
|   exported from {@link {$ doc.moduleDoc.id $} {$doc.moduleDoc.id $} } | ||||
|   defined in {$ github.githubViewLink(doc) $} | ||||
| 
 | ||||
| {% endblock %} | ||||
| @ -1,5 +1,5 @@ | ||||
| {% include "lib/githubLinks.html" -%} | ||||
| {% include "lib/paramList.html" -%} | ||||
| {% import "lib/githubLinks.html" as github -%} | ||||
| {% import "lib/paramList.html" as params -%} | ||||
| {% extends 'layout/base.template.html' %} | ||||
| 
 | ||||
| {% block body %} | ||||
| @ -27,6 +27,6 @@ div(layout="row" layout-xs="column" class="row-margin ng-cloak") | ||||
| 
 | ||||
| p.location-badge. | ||||
|   exported from {@link {$ doc.moduleDoc.id $} {$doc.moduleDoc.id $} } | ||||
|   defined in {$ githubViewLink(doc) $} | ||||
|   defined in {$ github.githubViewLink(doc) $} | ||||
| 
 | ||||
| {% endblock %} | ||||
|  | ||||
| @ -11,14 +11,14 @@ module.exports = new Package('angular-v2-docs', [jsdocPackage, nunjucksPackage, | ||||
| 
 | ||||
| // Register the processors
 | ||||
| .processor(require('./processors/convertPrivateClassesToInterfaces')) | ||||
| .processor(require('./processors/extractDirectiveClasses')) | ||||
| .processor(require('./processors/generateNavigationDoc')) | ||||
| .processor(require('./processors/extractTitleFromGuides')) | ||||
| .processor(require('./processors/createOverviewDump')) | ||||
| .processor(require('./processors/checkUnbalancedBackTicks')) | ||||
| .processor(require('./processors/convertBackticksToCodeBlocks')) | ||||
| .processor(require('./processors/addNotYetDocumentedProperty')) | ||||
| .processor(require('./processors/createDecoratorDocs')) | ||||
| .processor(require('./processors/mergeDecoratorDocs')) | ||||
| .processor(require('./processors/extractDecoratedClasses')) | ||||
| 
 | ||||
| .config(function(parseTagsProcessor) { | ||||
|   parseTagsProcessor.tagDefinitions.push({ name: 'internal', transforms: function() { return true; } }); | ||||
|  | ||||
| @ -1,39 +0,0 @@ | ||||
| module.exports = function mergeDecoratorDocs() { | ||||
|   return { | ||||
|     $runAfter: ['processing-docs'], | ||||
|     $runBefore: ['docs-processed'], | ||||
|     $process: function(docs) { | ||||
|       docs.forEach(function(doc) { | ||||
|         var makeDecorator = getMakeDecoratorCall(doc); | ||||
|         if (makeDecorator) { | ||||
|           doc.docType = 'decorator'; | ||||
|           doc.decoratorType = makeDecorator.arguments[0].text; | ||||
|         } | ||||
|       }); | ||||
|     } | ||||
|   }; | ||||
| }; | ||||
| 
 | ||||
| function getMakeDecoratorCall(doc, type) { | ||||
| 
 | ||||
|   var makeDecoratorFnName = 'make' + (type || '')+ 'Decorator'; | ||||
| 
 | ||||
|   var initializer = doc.exportSymbol && | ||||
|                     doc.exportSymbol.valueDeclaration && | ||||
|                     doc.exportSymbol.valueDeclaration.initializer; | ||||
| 
 | ||||
|   if (initializer) { | ||||
|     // There appear to be two forms of initializer:
 | ||||
|     //    export var Injectable: InjectableFactory = <InjectableFactory>makeDecorator(InjectableMetadata);
 | ||||
|     // and
 | ||||
|     //    export var RouteConfig: (configs: RouteDefinition[]) => ClassDecorator = makeDecorator(RouteConfigAnnotation);
 | ||||
|     // In the first case, the type assertion `<InjectableFactory>` causes the AST to contain an extra level of expression
 | ||||
|     // to hold the new type of the expression.
 | ||||
|     if (initializer.expression && initializer.expression.expression) { | ||||
|       initializer = initializer.expression; | ||||
|     } | ||||
|     if (initializer.expression && initializer.expression.text === makeDecoratorFnName) { | ||||
|       return initializer; | ||||
|     } | ||||
|   } | ||||
| } | ||||
| @ -1,14 +1,14 @@ | ||||
| var _ = require('lodash'); | ||||
| 
 | ||||
| module.exports = function extractDirectiveClassesProcessor(EXPORT_DOC_TYPES) { | ||||
| module.exports = function extractDecoratedClassesProcessor(EXPORT_DOC_TYPES) { | ||||
| 
 | ||||
|   // Add the "directive" docType into those that can be exported from a module
 | ||||
|   EXPORT_DOC_TYPES.push('directive'); | ||||
|   EXPORT_DOC_TYPES.push('directive', 'pipe'); | ||||
| 
 | ||||
|   return { | ||||
|     $runAfter: ['processing-docs'], | ||||
|     $runBefore: ['docs-processed'], | ||||
|     decoratorTypes: ['Directive', 'Component', 'View'], | ||||
|     decoratorTypes: ['Directive', 'Component', 'Pipe'], | ||||
|     $process: function(docs) { | ||||
|       var decoratorTypes = this.decoratorTypes; | ||||
| 
 | ||||
| @ -17,9 +17,8 @@ module.exports = function extractDirectiveClassesProcessor(EXPORT_DOC_TYPES) { | ||||
|         _.forEach(doc.decorators, function(decorator) { | ||||
| 
 | ||||
|           if (decoratorTypes.indexOf(decorator.name) !== -1) { | ||||
|             doc.docType = 'directive'; | ||||
| 
 | ||||
|             doc[decorator.name.toLowerCase() + 'Options'] = decorator.argumentInfo[0]; | ||||
|             doc.docType = decorator.name.toLowerCase(); | ||||
|             doc[doc.docType + 'Options'] = decorator.argumentInfo[0]; | ||||
|           } | ||||
|         }); | ||||
|       }); | ||||
| @ -27,4 +26,4 @@ module.exports = function extractDirectiveClassesProcessor(EXPORT_DOC_TYPES) { | ||||
|       return docs; | ||||
|     } | ||||
|   }; | ||||
| }; | ||||
| }; | ||||
| @ -0,0 +1,58 @@ | ||||
| var mockPackage = require('../mocks/mockPackage'); | ||||
| var Dgeni = require('dgeni'); | ||||
| 
 | ||||
| describe('extractDecoratedClasses processor', function() { | ||||
|   var dgeni, injector, processor; | ||||
| 
 | ||||
|   beforeEach(function() { | ||||
|     dgeni = new Dgeni([mockPackage()]); | ||||
|     injector = dgeni.configureInjector(); | ||||
|     processor = injector.get('extractDecoratedClassesProcessor'); | ||||
|   }); | ||||
| 
 | ||||
|   it('should extract specified decorator arguments', function() { | ||||
|     var doc1 = { | ||||
|       id: '@angular/common/ngFor', | ||||
|       name: 'ngFor', | ||||
|       docType: 'class', | ||||
|       decorators: [ | ||||
|         { | ||||
|           name: 'Directive', | ||||
|           arguments: ['{selector: \'[ng-for][ng-for-of]\', properties: [\'ngForOf\']}'], | ||||
|           argumentInfo: [ | ||||
|             { selector: '[ng-for][ng-for-of]', properties: ['ngForOf'] } | ||||
|           ] | ||||
|         } | ||||
|       ] | ||||
|     }; | ||||
|     var doc2 = { | ||||
|       id: '@angular/core/DecimalPipe', | ||||
|       name: 'DecimalPipe', | ||||
|       docType: 'class', | ||||
|       decorators: [ | ||||
|         { name: 'Pipe', arguments: ['{name: \'number\'}'], argumentInfo: [{ name: 'number' }]} | ||||
|       ] | ||||
|     }; | ||||
| 
 | ||||
|     processor.$process([doc1, doc2]); | ||||
| 
 | ||||
|     expect(doc1).toEqual(jasmine.objectContaining({ | ||||
|       id: '@angular/common/ngFor', | ||||
|       name: 'ngFor', | ||||
|       docType: 'directive', | ||||
|       directiveOptions: { | ||||
|         selector: '[ng-for][ng-for-of]', | ||||
|         properties: ['ngForOf'] | ||||
|       } | ||||
|     })); | ||||
| 
 | ||||
|     expect(doc2).toEqual(jasmine.objectContaining({ | ||||
|       id: '@angular/core/DecimalPipe', | ||||
|       name: 'DecimalPipe', | ||||
|       docType: 'pipe', | ||||
|       pipeOptions: { | ||||
|         name: 'number' | ||||
|       } | ||||
|     })); | ||||
|   }); | ||||
| }); | ||||
| @ -1,32 +0,0 @@ | ||||
| var _ = require('lodash'); | ||||
| var vm = require('vm'); | ||||
| 
 | ||||
| module.exports = function extractDirectiveClassesProcessor() { | ||||
|   return { | ||||
|     $runAfter: ['processing-docs'], | ||||
|     $runBefore: ['docs-processed'], | ||||
|     decoratorTypes: ['Directive', 'Component', 'View'], | ||||
|     $process: function(docs) { | ||||
|       var decoratorTypes = this.decoratorTypes; | ||||
| 
 | ||||
|       _.forEach(docs, function(doc) { | ||||
| 
 | ||||
|         _.forEach(doc.decorators, function(decorator) { | ||||
| 
 | ||||
|           if (decoratorTypes.indexOf(decorator.name) !== -1) { | ||||
| 
 | ||||
|             // We use this sneaky vm trick to extract the object literal
 | ||||
|             // argument from the decorator's constructor call
 | ||||
|             var args = decorator.arguments ? | ||||
|               vm.runInNewContext('dummy = ' + decorator.arguments[0]) : {}; | ||||
| 
 | ||||
|             doc[decorator.name.toLowerCase() + 'Options'] = args; | ||||
|             doc.docType = 'directive'; | ||||
|           } | ||||
|         }); | ||||
|       }); | ||||
| 
 | ||||
|       return docs; | ||||
|     } | ||||
|   }; | ||||
| }; | ||||
| @ -1,45 +0,0 @@ | ||||
| var mockPackage = require('../mocks/mockPackage'); | ||||
| var Dgeni = require('dgeni'); | ||||
| 
 | ||||
| describe('extractDirectiveClasses processor', function() { | ||||
|   var dgeni, injector, processor; | ||||
| 
 | ||||
|   beforeEach(function() { | ||||
|     dgeni = new Dgeni([mockPackage()]); | ||||
|     injector = dgeni.configureInjector(); | ||||
|     processor = injector.get('extractDirectiveClassesProcessor'); | ||||
|   }); | ||||
| 
 | ||||
|   it('should extract specified decorator arguments', function() { | ||||
|     var doc = { | ||||
|       id: 'angular2/angular2.ngFor', | ||||
|       name: 'ngFor', | ||||
|       docType: 'class', | ||||
|       decorators: [ | ||||
|         { | ||||
|           name: 'Directive', | ||||
|           arguments: ['{selector: \'[ng-for][ng-for-of]\', properties: [\'ngForOf\']}'] | ||||
|         } | ||||
|       ] | ||||
|     }; | ||||
| 
 | ||||
|     var docs = processor.$process([doc]); | ||||
| 
 | ||||
|     expect(doc).toEqual(jasmine.objectContaining({ | ||||
|       id: 'angular2/angular2.ngFor', | ||||
|       name: 'ngFor', | ||||
|       docType: 'directive', | ||||
|       decorators: [ | ||||
|         { | ||||
|           name: 'Directive', | ||||
|           arguments: ['{selector: \'[ng-for][ng-for-of]\', properties: [\'ngForOf\']}'] | ||||
|         } | ||||
|       ] | ||||
|     })); | ||||
| 
 | ||||
|     expect(doc.directiveOptions).toEqual({ | ||||
|       selector: '[ng-for][ng-for-of]', | ||||
|       properties: ['ngForOf'] | ||||
|     }); | ||||
|   }); | ||||
| }); | ||||
| @ -0,0 +1,88 @@ | ||||
| var _ = require('lodash'); | ||||
| 
 | ||||
| module.exports = function mergeDecoratorDocs() { | ||||
|   return { | ||||
|     $runAfter: ['processing-docs'], | ||||
|     $runBefore: ['docs-processed'], | ||||
|     docsToMergeInfo: [ | ||||
|       { nameTemplate: _.template('${name}Decorator'), decoratorProperty: 'decoratorInterfaceDoc' }, | ||||
|       { nameTemplate: _.template('${name}Metadata'), decoratorProperty: 'metadataDoc', useFields: ['howToUse', 'whatItDoes'] }, | ||||
|       { nameTemplate: _.template('${name}MetadataType'), decoratorProperty: 'metadataInterfaceDoc' }, | ||||
|       { nameTemplate: _.template('${name}MetadataFactory'), decoratorProperty: 'metadataFactoryDoc' } | ||||
|     ], | ||||
|     $process: function(docs) { | ||||
| 
 | ||||
|       var docsToMergeInfo = this.docsToMergeInfo; | ||||
|       var docsToMerge = Object.create(null); | ||||
| 
 | ||||
|       docs.forEach(function(doc) { | ||||
| 
 | ||||
|         // find all the decorators, signified by a call to `makeDecorator(metadata)`
 | ||||
|         var makeDecorator = getMakeDecoratorCall(doc); | ||||
|         if (makeDecorator) { | ||||
|           doc.docType = 'decorator'; | ||||
|           // get the type of the decorator metadata
 | ||||
|           doc.decoratorType = makeDecorator.arguments[0].text; | ||||
|           // clear the symbol type named (e.g. ComponentMetadataFactory) since it is not needed
 | ||||
|           doc.symbolTypeName = undefined; | ||||
| 
 | ||||
|           // keep track of the docs that need to be merged into this decorator doc
 | ||||
|           docsToMergeInfo.forEach(function(info) { | ||||
|             docsToMerge[info.nameTemplate({name: doc.name})] = { decoratorDoc: doc, property: info.decoratorProperty }; | ||||
|           }); | ||||
|         } | ||||
|       }); | ||||
| 
 | ||||
|       // merge the metadata docs into the decorator docs
 | ||||
|       docs = docs.filter(function(doc) { | ||||
|         if (docsToMerge[doc.name]) { | ||||
|           var decoratorDoc = docsToMerge[doc.name].decoratorDoc; | ||||
|           var property = docsToMerge[doc.name].property; | ||||
|           var useFields = docsToMerge[doc.name].useFields; | ||||
| 
 | ||||
|           // attach this document to its decorator
 | ||||
|           decoratorDoc[property] = doc; | ||||
| 
 | ||||
|           // Copy over fields from the merged doc if specified
 | ||||
|           if (useFields) { | ||||
|             useFields.forEach(function(field) { | ||||
|               decoratorDoc[field] = doc[field]; | ||||
|             }); | ||||
|           } | ||||
| 
 | ||||
|           // remove doc from its module doc's exports
 | ||||
|           doc.moduleDoc.exports = doc.moduleDoc.exports.filter(function(exportDoc) { return exportDoc !== doc; }); | ||||
| 
 | ||||
| 
 | ||||
|           // remove from the overall list of docs to be rendered
 | ||||
|           return false; | ||||
|         } | ||||
|         return true; | ||||
|       }); | ||||
|     } | ||||
|   }; | ||||
| }; | ||||
| 
 | ||||
| function getMakeDecoratorCall(doc, type) { | ||||
| 
 | ||||
|   var makeDecoratorFnName = 'make' + (type || '')+ 'Decorator'; | ||||
| 
 | ||||
|   var initializer = doc.exportSymbol && | ||||
|                     doc.exportSymbol.valueDeclaration && | ||||
|                     doc.exportSymbol.valueDeclaration.initializer; | ||||
| 
 | ||||
|   if (initializer) { | ||||
|     // There appear to be two forms of initializer:
 | ||||
|     //    export var Injectable: InjectableFactory = <InjectableFactory>makeDecorator(InjectableMetadata);
 | ||||
|     // and
 | ||||
|     //    export var RouteConfig: (configs: RouteDefinition[]) => ClassDecorator = makeDecorator(RouteConfigAnnotation);
 | ||||
|     // In the first case, the type assertion `<InjectableFactory>` causes the AST to contain an extra level of expression
 | ||||
|     // to hold the new type of the expression.
 | ||||
|     if (initializer.expression && initializer.expression.expression) { | ||||
|       initializer = initializer.expression; | ||||
|     } | ||||
|     if (initializer.expression && initializer.expression.text === makeDecoratorFnName) { | ||||
|       return initializer; | ||||
|     } | ||||
|   } | ||||
| } | ||||
| @ -1,9 +1,9 @@ | ||||
| {% include "lib/githubLinks.html" -%} | ||||
| {% import "lib/githubLinks.html" as github -%} | ||||
| {% extends 'layout/base.template.html' %} | ||||
| 
 | ||||
| {% block body %} | ||||
| <h1 class="id">{$ doc.id $} <span class="type">module</span></h1> | ||||
| <p>defined in {$ githubViewLink(doc) $}</p> | ||||
| <p>defined in {$ github.githubViewLink(doc) $}</p> | ||||
| <p>{$ doc.description | marked $}</p> | ||||
| 
 | ||||
| {% if doc.exports.length %} | ||||
|  | ||||
| @ -45,7 +45,8 @@ module.exports = function linkDocsInlineTagDef(parseArgString, createDocMessage, | ||||
|         var vers = _self.vers; | ||||
|         var prevUri = uri; | ||||
|         uri = path.join(lang, vers, uri); | ||||
|         log.info('Ajusted linkDocs chapter-relative uri (' + doc.fileInfo.baseName + '): ' + prevUri + ' -> ' + uri); | ||||
|         var fileName = doc.fileInfo ? (' (' + doc.fileInfo.baseName + ')') : ''; | ||||
|         log.info('Ajusted linkDocs chapter-relative uri' + fileName + ': ' + prevUri + ' -> ' + uri); | ||||
|       } | ||||
| 
 | ||||
|       var isValid = false; | ||||
|  | ||||
| @ -52,7 +52,7 @@ module.exports = new Package('dart-api-and-cheatsheet-builder', [basePackage, ta | ||||
| 
 | ||||
|   .config(function (convertPrivateClassesToInterfacesProcessor, | ||||
|     createOverviewDump, | ||||
|     extractDirectiveClassesProcessor, | ||||
|     extractDecoratedClassesProcessor, | ||||
|     extractJSDocCommentsProcessor, | ||||
|     extractTitleFromGuides, | ||||
|     generateNavigationDoc, | ||||
| @ -62,7 +62,7 @@ module.exports = new Package('dart-api-and-cheatsheet-builder', [basePackage, ta | ||||
|     // Clear out unwanted processors
 | ||||
|     createOverviewDump.$enabled = false; | ||||
|     convertPrivateClassesToInterfacesProcessor.$enabled = false; | ||||
|     extractDirectiveClassesProcessor.$enabled = false; | ||||
|     extractDecoratedClassesProcessor.$enabled = false; | ||||
|     extractJSDocCommentsProcessor.$enabled = false; | ||||
|     extractTitleFromGuides.$enabled = false; | ||||
|     generateNavigationDoc.$enabled = false; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user