Skip to content
This repository was archived by the owner on Mar 20, 2024. It is now read-only.

Commit 2a2fac5

Browse files
committed
Merge remote-tracking branch 'angulario/master'
2 parents 87117f6 + 19d0606 commit 2a2fac5

File tree

503 files changed

+15617
-2404
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

503 files changed

+15617
-2404
lines changed

gulpfile.js

+16-10
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ gulp.task('build-dart-api-docs', ['_shred-api-examples', 'dartdoc'], function()
595595
});
596596

597597
gulp.task('build-plunkers', ['_copy-example-boilerplate'], function() {
598-
return plunkerBuilder.buildPlunkers(EXAMPLES_PATH, LIVE_EXAMPLES_PATH, { errFn: gutil.log });
598+
return plunkerBuilder.buildPlunkers(EXAMPLES_PATH, LIVE_EXAMPLES_PATH, { errFn: gutil.log, build: argv.build });
599599
});
600600

601601
gulp.task('build-dart-cheatsheet', [], function() {
@@ -604,20 +604,19 @@ gulp.task('build-dart-cheatsheet', [], function() {
604604

605605
gulp.task('dartdoc', ['pub upgrade'], function() {
606606
const ngRepoPath = ngPathFor('dart');
607-
if (argv.fast && fs.existsSync(path.resolve(ngRepoPath, 'doc'))) {
608-
gutil.log('Skipping dartdoc: --fast flag enabled and "doc" dir exists');
607+
if (argv.fast && fs.existsSync(path.resolve(ngRepoPath, 'docs', 'api'))) {
608+
gutil.log('Skipping dartdoc: --fast flag enabled and "docs/api" dir exists');
609609
return true;
610610
}
611611
checkAngularProjectPath(ngRepoPath);
612612
const topLevelLibFilePath = path.resolve(ngRepoPath, 'lib', 'angular2.dart');
613613
const tmpPath = topLevelLibFilePath + '.disabled';
614-
if (!fs.existsSync(topLevelLibFilePath)) throw new Error(`Missing file: ${topLevelLibFilePath}`);
615-
fs.renameSync(topLevelLibFilePath, tmpPath);
614+
renameIfExistsSync(topLevelLibFilePath, tmpPath);
616615
gutil.log(`Hiding top-level angular2 library: ${topLevelLibFilePath}`);
617-
const dartdoc = spawnExt('dartdoc', ['--output', 'doc/api', '--add-crossdart'], { cwd: ngRepoPath});
616+
const dartdoc = spawnExt('dartdoc', ['--output', 'docs/api', '--add-crossdart'], { cwd: ngRepoPath});
618617
return dartdoc.promise.finally(() => {
619618
gutil.log(`Restoring top-level angular2 library: ${topLevelLibFilePath}`);
620-
fs.renameSync(tmpPath, topLevelLibFilePath);
619+
renameIfExistsSync(tmpPath, topLevelLibFilePath);
621620
})
622621
});
623622

@@ -1235,15 +1234,14 @@ function buildDartCheatsheet() {
12351234

12361235

12371236
function buildApiDocsForDart() {
1238-
const apiDir = 'api';
12391237
const vers = 'latest';
12401238
const dab = require('./tools/dart-api-builder/dab')(ANGULAR_IO_PROJECT_PATH);
12411239
const log = dab.log;
12421240

12431241
log.level = _dgeniLogLevel;
12441242
const dabInfo = dab.dartPkgConfigInfo;
1245-
dabInfo.ngIoDartApiDocPath = path.join(DOCS_PATH, 'dart', vers, apiDir);
1246-
dabInfo.ngDartDocPath = path.join(ngPathFor('dart'), 'doc', apiDir);
1243+
dabInfo.ngIoDartApiDocPath = path.join(DOCS_PATH, 'dart', vers, 'api');
1244+
dabInfo.ngDartDocPath = path.join(ngPathFor('dart'), 'docs', 'api');
12471245
// Exclude API entries for developer/internal libraries. Also exclude entries for
12481246
// the top-level catch all "angular2" library (otherwise every entry appears twice).
12491247
dabInfo.excludeLibRegExp = new RegExp(/^(?!angular2)|\.testing|_|codegen|^angular2$/);
@@ -1455,3 +1453,11 @@ function checkAngularProjectPath(_ngPath) {
14551453
if (fs.existsSync(ngPath)) return;
14561454
throw new Error('API related tasks require the angular2 repo to be at ' + ngPath);
14571455
}
1456+
1457+
function renameIfExistsSync(oldPath, newPath) {
1458+
if (fs.existsSync(oldPath)) {
1459+
fs.renameSync(oldPath, newPath);
1460+
} else {
1461+
gutil.log(`renameIfExistsSync cannot find file to rename: ${oldPath}`);
1462+
}
1463+
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"browser-sync": "^2.9.3",
3333
"canonical-path": "0.0.2",
3434
"cheerio": "^0.20.0",
35-
"codelyzer": "0.0.22",
35+
"codelyzer": "0.0.26",
3636
"cross-spawn": "^4.0.0",
3737
"del": "^2.2.0",
3838
"dgeni": "^0.4.0",

public/_includes/_util-fns.jade

+9
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@
3838
//- Location of sample code
3939
- var _liveLink = 'live link';
4040

41+
//- NgModule related
42+
- var _AppModuleVsAppComp = 'AppModule'
43+
- var _appModuleTsVsAppCompTs = 'app/app.module.ts'
44+
- var _appModuleTsVsMainTs = 'app/app.module.ts'
45+
- var _bootstrapModule = 'bootstrapModule'
46+
- var _moduleVsComp = 'module'
47+
- var _moduleVsRootComp = 'module'
48+
- var _platformBrowserDynamicVsBootStrap = 'platformBrowserDynamic'
49+
4150
//- Other
4251
- var _truthy = 'truthy';
4352
- var _falsey = 'falsey';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { NgModule } from '@angular/core';
2+
import { BrowserModule } from '@angular/platform-browser';
3+
4+
import { HeroTeamBuilderComponent } from './hero-team-builder.component';
5+
import { HeroListBasicComponent } from './hero-list-basic.component';
6+
import { HeroListInlineStylesComponent } from './hero-list-inline-styles.component';
7+
import { HeroListEnterLeaveComponent } from './hero-list-enter-leave.component';
8+
import { HeroListEnterLeaveStatesComponent } from './hero-list-enter-leave-states.component';
9+
import { HeroListCombinedTransitionsComponent } from './hero-list-combined-transitions.component';
10+
import { HeroListTwowayComponent } from './hero-list-twoway.component';
11+
import { HeroListAutoComponent } from './hero-list-auto.component';
12+
import { HeroListGroupsComponent } from './hero-list-groups.component';
13+
import { HeroListMultistepComponent } from './hero-list-multistep.component';
14+
import { HeroListTimingsComponent } from './hero-list-timings.component';
15+
16+
@NgModule({
17+
imports: [ BrowserModule ],
18+
declarations: [
19+
HeroTeamBuilderComponent,
20+
HeroListBasicComponent,
21+
HeroListInlineStylesComponent,
22+
HeroListCombinedTransitionsComponent,
23+
HeroListTwowayComponent,
24+
HeroListEnterLeaveComponent,
25+
HeroListEnterLeaveStatesComponent,
26+
HeroListAutoComponent,
27+
HeroListTimingsComponent,
28+
HeroListMultistepComponent,
29+
HeroListGroupsComponent
30+
],
31+
bootstrap: [ HeroTeamBuilderComponent ]
32+
})
33+
export class AppModule { }

public/docs/_examples/animations/ts/app/hero-team-builder.component.ts

-22
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
11
import { Component } from '@angular/core';
22

33
import { Heroes } from './hero.service';
4-
import { HeroListBasicComponent } from './hero-list-basic.component';
5-
import { HeroListInlineStylesComponent } from './hero-list-inline-styles.component';
6-
import { HeroListEnterLeaveComponent } from './hero-list-enter-leave.component';
7-
import { HeroListEnterLeaveStatesComponent } from './hero-list-enter-leave-states.component';
8-
import { HeroListCombinedTransitionsComponent } from './hero-list-combined-transitions.component';
9-
import { HeroListTwowayComponent } from './hero-list-twoway.component';
10-
import { HeroListAutoComponent } from './hero-list-auto.component';
11-
import { HeroListGroupsComponent } from './hero-list-groups.component';
12-
import { HeroListMultistepComponent } from './hero-list-multistep.component';
13-
import { HeroListTimingsComponent } from './hero-list-timings.component';
144

155
@Component({
166
selector: 'hero-team-builder',
@@ -97,18 +87,6 @@ import { HeroListTimingsComponent } from './hero-list-timings.component';
9787
min-height: 6em;
9888
}
9989
`],
100-
directives: [
101-
HeroListBasicComponent,
102-
HeroListInlineStylesComponent,
103-
HeroListCombinedTransitionsComponent,
104-
HeroListTwowayComponent,
105-
HeroListEnterLeaveComponent,
106-
HeroListEnterLeaveStatesComponent,
107-
HeroListAutoComponent,
108-
HeroListTimingsComponent,
109-
HeroListMultistepComponent,
110-
HeroListGroupsComponent
111-
],
11290
providers: [Heroes]
11391
})
11492
export class HeroTeamBuilderComponent {
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { bootstrap } from '@angular/platform-browser-dynamic';
1+
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
2+
import { AppModule } from './app.module';
23

3-
import { HeroTeamBuilderComponent } from './hero-team-builder.component';
4-
5-
bootstrap(HeroTeamBuilderComponent);
4+
platformBrowserDynamic().bootstrapModule(AppModule);

public/docs/_examples/architecture/ts/app/app.component.ts

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
// #docregion import
22
import { Component } from '@angular/core';
33
// #enddocregion import
4-
import { HeroListComponent } from './hero-list.component';
5-
import { SalesTaxComponent } from './sales-tax.component';
64

75
@Component({
86
selector: 'my-app',
97
template: `
10-
<hero-list></hero-list>
11-
<sales-tax></sales-tax>
12-
`,
13-
directives: [HeroListComponent, SalesTaxComponent]
8+
<hero-list></hero-list>
9+
<sales-tax></sales-tax>
10+
`
1411
})
1512
// #docregion export
1613
export class AppComponent { }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import { BrowserModule } from '@angular/platform-browser';
2+
import { FormsModule } from '@angular/forms';
3+
// #docregion imports
4+
import { NgModule } from '@angular/core';
5+
import { AppComponent } from './app.component';
6+
// #enddocregion imports
7+
import { HeroDetailComponent } from './hero-detail.component';
8+
import { HeroListComponent } from './hero-list.component';
9+
import { SalesTaxComponent } from './sales-tax.component';
10+
import { HeroService } from './hero.service';
11+
import { BackendService } from './backend.service';
12+
import { Logger } from './logger.service';
13+
14+
@NgModule({
15+
imports: [
16+
BrowserModule,
17+
FormsModule
18+
],
19+
declarations: [
20+
AppComponent,
21+
HeroDetailComponent,
22+
HeroListComponent,
23+
SalesTaxComponent
24+
],
25+
// #docregion providers
26+
providers: [
27+
BackendService,
28+
HeroService,
29+
Logger
30+
],
31+
// #enddocregion providers
32+
bootstrap: [ AppComponent ]
33+
})
34+
// #docregion export
35+
export class AppModule { }
36+
// #enddocregion export

public/docs/_examples/architecture/ts/app/hero-detail.component.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ import { Hero } from './hero';
44

55
@Component({
66
selector: 'hero-detail',
7-
templateUrl: 'app/hero-detail.component.html',
8-
directives: [HeroDetailComponent]
7+
templateUrl: 'app/hero-detail.component.html'
98
})
109
export class HeroDetailComponent {
1110
@Input() hero: Hero;

public/docs/_examples/architecture/ts/app/hero-list.component.ts

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
import { Component, OnInit } from '@angular/core';
22

33
import { Hero } from './hero';
4-
import { HeroDetailComponent } from './hero-detail.component';
54
import { HeroService } from './hero.service';
65

7-
// #docregion metadata
6+
// #docregion metadata, providers
87
@Component({
98
selector: 'hero-list',
109
templateUrl: 'app/hero-list.component.html',
11-
directives: [HeroDetailComponent],
12-
// #docregion providers
13-
providers: [HeroService]
14-
// #enddocregion providers
10+
providers: [ HeroService ]
1511
})
12+
// #enddocregion providers
1613
// #docregion class
1714
export class HeroListComponent implements OnInit {
1815
// #enddocregion metadata
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
1-
import { bootstrap } from '@angular/platform-browser-dynamic';
2-
// #docregion import
3-
import { AppComponent } from './app.component';
4-
// #enddocregion import
5-
import { HeroService } from './hero.service';
6-
import { BackendService } from './backend.service';
7-
import { Logger } from './logger.service';
1+
// #docregion
2+
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
3+
import { AppModule } from './app.module';
84

9-
// #docregion bootstrap
10-
bootstrap(AppComponent, [BackendService, HeroService, Logger]);
11-
// #enddocregion bootstrap
5+
platformBrowserDynamic().bootstrapModule(AppModule);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// #docplaster
2+
// A mini-application
3+
import { Injectable } from '@angular/core';
4+
5+
@Injectable()
6+
export class Logger {
7+
log(message: string) { console.log(message); }
8+
}
9+
10+
// #docregion import-core-component
11+
import { Component } from '@angular/core';
12+
// #enddocregion import-core-component
13+
14+
@Component({
15+
selector: 'my-app',
16+
template: 'Welcome to Angular 2'
17+
})
18+
export class AppComponent {
19+
constructor(logger: Logger) {
20+
logger.log('Let the fun begin!');
21+
}
22+
}
23+
24+
// #docregion module
25+
import { NgModule } from '@angular/core';
26+
// #docregion import-browser-module
27+
import { BrowserModule } from '@angular/platform-browser';
28+
// #enddocregion import-browser-module
29+
@NgModule({
30+
// #docregion ngmodule-imports
31+
imports: [ BrowserModule ],
32+
// #enddocregion ngmodule-imports
33+
providers: [ Logger ],
34+
declarations: [ AppComponent ],
35+
exports: [ AppComponent ],
36+
bootstrap: [ AppComponent ]
37+
})
38+
// #docregion export
39+
export class AppModule { }
40+
// #enddocregion export
41+
// #enddocregion module
42+
43+
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
44+
45+
platformBrowserDynamic().bootstrapModule(AppModule);

public/docs/_examples/architecture/ts/app/sales-tax.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { TaxRateService } from './tax-rate.service';
1414
{{ getTax(amountBox.value) | currency:'USD':true:'1.2-2' }}
1515
</div>
1616
`,
17-
providers: [SalesTaxService, TaxRateService]
17+
providers: [SalesTaxService, TaxRateService]
1818
})
1919
export class SalesTaxComponent {
2020
constructor(private salesTaxService: SalesTaxService) { }
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
<!DOCTYPE html>
2-
<!-- #docregion -->
32
<html>
43
<head>
5-
<base href="/">
6-
<title>Router Sample v.3</title>
4+
<title>Architecture of Angular 2</title>
75
<meta charset="UTF-8">
86
<meta name="viewport" content="width=device-width, initial-scale=1">
97
<link rel="stylesheet" href="styles.css">
@@ -17,15 +15,12 @@
1715

1816
<script src="systemjs.config.js"></script>
1917
<script>
20-
System.import('app/main.3') // <----- ONLY CHANGE
21-
.catch(function(err){ console.error(err); });
18+
System.import('app/mini-app').catch(function(err){ console.error(err); });
2219
</script>
2320
</head>
2421

2522
<body>
26-
<h1>Milestone 3</h1>
27-
<my-app>loading...</my-app>
23+
<my-app>Loading...</my-app>
2824
</body>
2925

3026
</html>
31-
<!-- #enddocregion -->
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
// #docregion
22
import { Component } from '@angular/core';
33

4-
import { HighlightDirective } from './highlight.directive';
5-
64
@Component({
75
selector: 'my-app',
8-
templateUrl: 'app/app.component.html',
9-
directives: [HighlightDirective]
6+
templateUrl: 'app/app.component.html'
107
})
118

129
export class AppComponent { }
13-
1410
// #enddocregion
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// #docregion
2+
import { NgModule } from '@angular/core';
3+
import { BrowserModule } from '@angular/platform-browser';
4+
5+
import { AppComponent } from './app.component';
6+
import { HighlightDirective } from './highlight.directive';
7+
8+
@NgModule({
9+
imports: [ BrowserModule ],
10+
declarations: [
11+
AppComponent,
12+
HighlightDirective
13+
],
14+
bootstrap: [ AppComponent ]
15+
})
16+
export class AppModule { }

0 commit comments

Comments
 (0)