Skip to content

Commit 180a141

Browse files
committed
docs(upgrade): update tutorial and examples to alpha.50
1 parent 9d7945e commit 180a141

Some content is hidden

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

42 files changed

+252
-143
lines changed

public/docs/_examples/upgrade/ts/classes/src/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<script src="bower_components/angular-resource/angular-resource.js"></script>
1616
<script>
1717
System.config({
18-
packages: {'app': {}}
18+
packages: {'app': {defaultExtension: 'js'}}
1919
});
2020
System.import('app/app');
2121
</script>

public/docs/_examples/upgrade/ts/classes/src/test/karma.conf.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
module.exports = function(config){
22
config.set({
33

4-
basePath : '../',
4+
basePath : '../..',
55

66
// #docregion files
77
files : [
8-
'bower_components/angular/angular.js',
9-
'bower_components/angular-route/angular-route.js',
10-
'bower_components/angular-resource/angular-resource.js',
11-
'bower_components/angular-animate/angular-animate.js',
12-
'bower_components/angular-mocks/angular-mocks.js',
13-
'../node_modules/systemjs/dist/system.src.js',
14-
'test/karma_test_shim.js',
15-
{pattern: 'app/**/*.js', included: false, watched: true},
16-
{pattern: 'test/unit/**/*.js', included: false, watched: true}
8+
'src/bower_components/angular/angular.js',
9+
'src/bower_components/angular-route/angular-route.js',
10+
'src/bower_components/angular-resource/angular-resource.js',
11+
'src/bower_components/angular-animate/angular-animate.js',
12+
'src/bower_components/angular-mocks/angular-mocks.js',
13+
'node_modules/systemjs/dist/system.src.js',
14+
'src/test/karma_test_shim.js',
15+
{pattern: 'src/app/**/*.js', included: false, watched: true},
16+
{pattern: 'src/test/unit/**/*.js', included: false, watched: true}
1717
],
1818
// #enddocregion files
1919

public/docs/_examples/upgrade/ts/classes/src/test/karma_test_shim.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ __karma__.loaded = function() {};
55

66
System.config({
77
packages: {
8-
'base/app': {
8+
'base/src/app': {
99
defaultExtension: false,
1010
format: 'register',
1111
map: Object.keys(window.__karma__.files).
1212
filter(onlyAppFiles).
1313
reduce(function createPathRecords(pathsMapping, appPath) {
1414
// creates local module name mapping to global path with karma's fingerprint in path, e.g.:
1515
// './hero.service': '/base/src/app/hero.service.js?f4523daf879cfb7310ef6242682ccf10b2041b3e'
16-
var moduleName = appPath.replace(/^\/base\/app\//, './').replace(/\.js$/, '');
16+
var moduleName = appPath.replace(/^\/base\/src\/app\//, './').replace(/\.js$/, '');
1717
pathsMapping[moduleName] = appPath + '?' + window.__karma__.files[appPath]
1818
return pathsMapping;
1919
}, {})
@@ -36,7 +36,7 @@ Promise.all(
3636
});
3737

3838
function onlyAppFiles(filePath) {
39-
return /^\/base\/app\/.*\.js$/.test(filePath)
39+
return /^\/base\/src\/app\/.*\.js$/.test(filePath)
4040
}
4141

4242
function onlySpecFiles(path) {

public/docs/_examples/upgrade/ts/ng2_components/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@
3131

3232
"preprotractor": "npm run update-webdriver",
3333
"protractor": "protractor src/test/protractor-conf.js",
34-
34+
3535
"tsc": "tsc -p src -w"
3636
},
3737
"dependencies": {
38-
"angular2": "^2.0.0-alpha.46",
38+
"angular2": "2.0.0-alpha.50",
3939
"systemjs": "^0.19.6",
4040
"typescript": "^1.6.2"
4141
}

public/docs/_examples/upgrade/ts/ng2_components/src/app/core/CheckmarkPipe.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// #docregion
2-
import {Pipe} from 'angular2/angular2';
2+
import {Pipe} from 'angular2/core';
33

44
@Pipe({name: 'checkmark'})
55
export class CheckmarkPipe {

public/docs/_examples/upgrade/ts/ng2_components/src/app/core/Phones.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
// #docregion full
2-
import {Injectable, Observable} from 'angular2/angular2';
2+
import {Injectable, Observable} from 'angular2/core';
33
import {Http, Response} from 'angular2/http';
44

5+
import 'rxjs/operator/map';
6+
57
// #docregion phone-interface
68
export interface Phone {
79
name: string;

public/docs/_examples/upgrade/ts/ng2_components/src/app/phone_detail/PhoneDetail.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// #docregion
22
// #docregion top
3-
import {Component, Inject} from 'angular2/angular2';
3+
import {Component, Inject} from 'angular2/core';
44
import {Phones, Phone} from '../core/Phones';
55
import {CheckmarkPipe} from '../core/CheckmarkPipe';
66

public/docs/_examples/upgrade/ts/ng2_components/src/app/phone_detail/PhoneDetail_without_pipes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// #docregion
2-
import {Component, Inject} from 'angular2/angular2';
2+
import {Component, Inject} from 'angular2/core';
33
import {Phones, Phone} from '../core/Phones';
44

55
interface PhoneRouteParams {

public/docs/_examples/upgrade/ts/ng2_components/src/app/phone_list/OrderByPipe.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// #docregion
2-
import {Pipe} from 'angular2/angular2';
2+
import {Pipe} from 'angular2/core';
33

44
@Pipe({name: 'orderBy'})
55
export default class OrderByPipe {

public/docs/_examples/upgrade/ts/ng2_components/src/app/phone_list/PhoneFilterPipe.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// #docregion
2-
import {Pipe} from 'angular2/angular2';
2+
import {Pipe} from 'angular2/core';
33
import {Phone} from '../core/Phones';
44

55
@Pipe({name: 'phoneFilter'})

public/docs/_examples/upgrade/ts/ng2_components/src/app/phone_list/PhoneList.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// #docregion full
22
// #docregion top
3-
import {Component, Observable} from 'angular2/angular2';
3+
import {Component, Observable} from 'angular2/core';
44
import {Phones, Phone} from '../core/Phones';
55
import PhoneFilterPipe from './PhoneFilterPipe';
66
import OrderByPipe from './OrderByPipe';

public/docs/_examples/upgrade/ts/ng2_components/src/app/phone_list/PhoneList_without_pipes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// #docregion top
2-
import {Component, Observable} from 'angular2/angular2';
2+
import {Component, Observable} from 'angular2/core';
33
import {Phones, Phone} from '../core/Phones';
44

55
@Component({

public/docs/_examples/upgrade/ts/ng2_components/src/index.html

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,18 @@
1616
<script src="../node_modules/angular2/bundles/http.dev.js"></script>
1717
<script>
1818
System.config({
19-
packages: {'app': {}}
19+
packages: {
20+
'app': {
21+
defaultExtension: 'js'
22+
},
23+
'../node_modules/rxjs': {
24+
defaultExtension: 'js'
25+
}
26+
},
27+
paths: {
28+
'rxjs/*' : '../node_modules/rxjs/*.js',
29+
'rxjs/operator/*': '../node_modules/rxjs/add/operator/*.js'
30+
}
2031
});
2132
System.import('app/app');
2233
</script>

public/docs/_examples/upgrade/ts/ng2_components/src/test/karma.conf.js

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,40 @@
1-
// #docregion templates
21
module.exports = function(config){
32
config.set({
4-
// #enddocregion templates
5-
basePath : '../',
63

7-
// #docregion templates
4+
basePath : '../..',
5+
6+
// #docregion html
87
files : [
9-
// #enddocregion templates
10-
11-
'bower_components/angular/angular.js',
12-
'bower_components/angular-route/angular-route.js',
13-
'bower_components/angular-resource/angular-resource.js',
14-
'bower_components/angular-animate/angular-animate.js',
15-
'bower_components/angular-mocks/angular-mocks.js',
16-
'../node_modules/systemjs/dist/system.src.js',
17-
'../node_modules/angular2/bundles/angular2.dev.js',
18-
'../node_modules/angular2/bundles/http.dev.js',
19-
'../node_modules/angular2/bundles/testing.js',
20-
'test/karma_test_shim.js',
21-
{pattern: 'app/**/*.js', included: false, watched: true},
22-
// #docregion templates
23-
{pattern: 'app/**/*.html', included: false, watched: true},
24-
// #enddocregion templates
25-
{pattern: 'test/unit/**/*.js', included: false, watched: true}
26-
// #docregion templates
8+
// #enddocregion html
9+
'src/bower_components/angular/angular.js',
10+
'src/bower_components/angular-route/angular-route.js',
11+
'src/bower_components/angular-resource/angular-resource.js',
12+
'src/bower_components/angular-animate/angular-animate.js',
13+
'src/bower_components/angular-mocks/angular-mocks.js',
14+
// #docregion ng2
15+
'node_modules/systemjs/dist/system.src.js',
16+
'node_modules/angular2/bundles/angular2.dev.js',
17+
// #enddocregion ng2
18+
// #docregion ng2-http
19+
'node_modules/angular2/bundles/http.dev.js',
20+
// #enddocregion ng2-http
21+
'src/test/karma_test_shim.js',
22+
{pattern: 'src/app/**/*.js', included: false, watched: true},
23+
{pattern: 'src/test/unit/**/*.js', included: false, watched: true},
24+
// #docregion ng2-testing
25+
'node_modules/angular2/bundles/testing.js',
26+
{pattern: 'node_modules/rxjs/**/*.js', included: false, watched: false},
27+
// #enddocregion ng2-testing
28+
29+
// #docregion html
30+
{pattern: 'src/**/*.html', included: false, watched: true}
2731
],
28-
// #enddocregion templates
32+
33+
proxies: {
34+
// required for component assests fetched by Angular's compiler
35+
"/app/": "/base/src/app/"
36+
},
37+
// #enddocregion html
2938

3039
autoWatch : true,
3140

@@ -44,12 +53,7 @@ module.exports = function(config){
4453
suite: 'unit'
4554
},
4655

47-
// #docregion templates
48-
proxies: {
49-
// required for component assests fetched by Angular's compiler
50-
"/app/": "/base/app/"
51-
},
56+
logLevel: 'LOG_DEBUG'
5257

5358
});
5459
};
55-
// #enddocregion templates

public/docs/_examples/upgrade/ts/ng2_components/src/test/karma_test_shim.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,35 @@
1+
// #docregion
12
// Cancel Karma's synchronous start,
23
// we will call `__karma__.start()` later, once all the specs are loaded.
34
__karma__.loaded = function() {};
45

56
System.config({
67
packages: {
7-
'base/app': {
8+
'base/src/app': {
89
defaultExtension: false,
910
format: 'register',
1011
map: Object.keys(window.__karma__.files).
1112
filter(onlyAppFiles).
1213
reduce(function createPathRecords(pathsMapping, appPath) {
1314
// creates local module name mapping to global path with karma's fingerprint in path, e.g.:
1415
// './hero.service': '/base/src/app/hero.service.js?f4523daf879cfb7310ef6242682ccf10b2041b3e'
15-
var moduleName = appPath.replace(/^\/base\/app\//, './').replace(/\.js$/, '');
16+
var moduleName = appPath.replace(/^\/base\/src\/app\//, './').replace(/\.js$/, '');
1617
pathsMapping[moduleName] = appPath + '?' + window.__karma__.files[appPath]
1718
return pathsMapping;
1819
}, {})
19-
20-
}
20+
},
21+
'base/node_modules/rxjs': {
22+
defaultExtension: 'js'
2123
}
24+
},
25+
paths: {
26+
'rxjs/*' : '../base/node_modules/rxjs/*.js',
27+
'rxjs/operator/*': '../base/node_modules/rxjs/add/operator/*.js'
28+
}
2229
});
2330

24-
System.import('angular2/src/core/dom/browser_adapter').then(function(browser_adapter) {
31+
// #docregion ng2
32+
System.import('angular2/src/platform/browser/browser_adapter').then(function(browser_adapter) {
2533
browser_adapter.BrowserDomAdapter.makeCurrent();
2634
}).then(function() {
2735
return Promise.all(
@@ -36,9 +44,10 @@ System.import('angular2/src/core/dom/browser_adapter').then(function(browser_ada
3644
}, function(error) {
3745
__karma__.error(error.stack || error);
3846
});
47+
// #enddocregion ng2
3948

4049
function onlyAppFiles(filePath) {
41-
return /^\/base\/app\/.*\.js$/.test(filePath)
50+
return /^\/base\/src\/app\/.*\.js$/.test(filePath)
4251
}
4352

4453
function onlySpecFiles(path) {

public/docs/_examples/upgrade/ts/ng2_components/src/test/unit/PhoneDetail_spec.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// #docregion
2-
import {Observable, provide} from 'angular2/angular2';
2+
import {Observable, provide} from 'angular2/core';
33
import {HTTP_PROVIDERS} from 'angular2/http';
4+
import {FromObservable} from 'rxjs/observable/from';
5+
46
import {
57
describe,
68
beforeEachProviders,
@@ -22,7 +24,7 @@ function xyzPhoneData():Phone {
2224

2325
class MockPhones extends Phones {
2426
get(id):Observable<Phone> {
25-
return Observable.from([xyzPhoneData()]);
27+
return FromObservable.create([xyzPhoneData()]);
2628
}
2729
}
2830

public/docs/_examples/upgrade/ts/ng2_components/src/test/unit/PhoneList_spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// #docregion
22
import {Observable, provide} from 'angular2/angular2';
33
import {HTTP_PROVIDERS} from 'angular2/http';
4+
import {FromObservable} from 'rxjs/observable/from';
5+
46
import {
57
describe,
68
beforeEachProviders,
@@ -14,7 +16,7 @@ import {Phones, Phone} from '../../app/core/Phones';
1416

1517
class MockPhones extends Phones {
1618
query():Observable<Phone[]> {
17-
return Observable.from([
19+
return FromObservable.create([
1820
[{name: 'Nexus S'}, {name: 'Motorola DROID'}]
1921
])
2022
}

public/docs/_examples/upgrade/ts/ng2_final/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"tsc": "tsc -p src -w"
3636
},
3737
"dependencies": {
38-
"angular2": "^2.0.0-alpha.46",
38+
"angular2": "2.0.0-alpha.50",
3939
"systemjs": "^0.19.6",
4040
"typescript": "^1.6.2"
4141
}

public/docs/_examples/upgrade/ts/ng2_final/src/app/app.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// #docregion
22
// #docregion importbootstrap
3-
import {Component, bootstrap, provide} from 'angular2/angular2';
3+
import {Component, provide} from 'angular2/core';
4+
import {bootstrap} from 'angular2/platform/browser';
45
// #enddocregion importbootstrap
56

67
import {Phones} from './core/Phones';
@@ -23,7 +24,7 @@ import {
2324
@RouteConfig([
2425
{path:'/phones', as: 'Phones', component: PhoneList},
2526
{path:'/phones/:phoneId', as: 'Phone', component: PhoneDetail},
26-
{path:'/', redirectTo: '/phones'}
27+
{path:'/', redirectTo: ['/phones']}
2728
])
2829
@Component({
2930
selector: 'app',

public/docs/_examples/upgrade/ts/ng2_final/src/app/core/CheckmarkPipe.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// #docregion
2-
import {Pipe} from 'angular2/angular2';
2+
import {Pipe} from 'angular2/core';
33

44
@Pipe({name: 'checkmark'})
55
export class CheckmarkPipe {

public/docs/_examples/upgrade/ts/ng2_final/src/app/core/Phones.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
// #docregion full
2-
import {Injectable, Observable} from 'angular2/angular2';
2+
import {Injectable, Observable} from 'angular2/core';
33
import {Http, Response} from 'angular2/http';
44

5+
import 'rxjs/operator/map';
6+
57
// #docregion phone-interface
68
export interface Phone {
79
name: string;

public/docs/_examples/upgrade/ts/ng2_final/src/app/phone_detail/PhoneDetail.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// #docregion
22
// #docregion top
3-
import {Component, Inject} from 'angular2/angular2';
3+
import {Component, Inject} from 'angular2/core';
44
import {RouteParams} from 'angular2/router';
55
import {Phones, Phone} from '../core/Phones';
66
import {CheckmarkPipe} from '../core/CheckmarkPipe';

public/docs/_examples/upgrade/ts/ng2_final/src/app/phone_list/OrderByPipe.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// #docregion
2-
import {Pipe} from 'angular2/angular2';
2+
import {Pipe} from 'angular2/core';
33

44
@Pipe({name: 'orderBy'})
55
export default class OrderByPipe {

public/docs/_examples/upgrade/ts/ng2_final/src/app/phone_list/PhoneFilterPipe.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// #docregion
2-
import {Pipe} from 'angular2/angular2';
2+
import {Pipe} from 'angular2/core';
33
import {Phone} from '../core/Phones';
44

55
@Pipe({name: 'phoneFilter'})

0 commit comments

Comments
 (0)