Skip to content

Commit 1770529

Browse files
author
Tsvetoslav Lazarov
committed
Changed some versions of Angular and Angular-CLI causing problems with routing (angular/angular-cli#3662)
1 parent 27ae514 commit 1770529

17 files changed

+183
-29
lines changed

.gitignore

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,22 @@
66

77
# dependencies
88
/node_modules
9-
/bower_components
109

1110
# IDEs and editors
1211
/.idea
13-
/.vscode
1412
.project
1513
.classpath
1614
.c9/
1715
*.launch
1816
.settings/
1917

18+
# IDE - VSCode
19+
.vscode/*
20+
!.vscode/settings.json
21+
!.vscode/tasks.json
22+
!.vscode/launch.json
23+
!.vscode/extensions.json
24+
2025
# misc
2126
/.sass-cache
2227
/connect.lock

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# TeamDirective17
22

3-
This project was generated with [angular-cli](https://github.com/angular/angular-cli) version 1.0.0-beta.22-1.
3+
This project was generated with [angular-cli](https://github.com/angular/angular-cli) version 1.0.0-beta.24.
44

55
## Development server
66
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
77

88
## Code scaffolding
99

10-
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive/pipe/service/class`.
10+
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive/pipe/service/class/module`.
1111

1212
## Build
1313

@@ -28,4 +28,4 @@ Run `ng github-pages:deploy` to deploy to Github Pages.
2828

2929
## Further help
3030

31-
To get more help on the `angular-cli` use `ng --help` or go check out the [Angular-CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
31+
To get more help on the `angular-cli` use `ng help` or go check out the [Angular-CLI README](https://github.com/angular/angular-cli/blob/master/README.md).

angular-cli.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"project": {
3-
"version": "1.0.0-beta.22-1",
3+
"version": "1.0.0-beta.24",
44
"name": "team-directive-17"
55
},
66
"apps": [

e2e/app.e2e-spec.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { TeamDirective17Page } from './app.po';
2+
3+
describe('team-directive-17 App', function() {
4+
let page: TeamDirective17Page;
5+
6+
beforeEach(() => {
7+
page = new TeamDirective17Page();
8+
});
9+
10+
it('should display message saying app works', () => {
11+
page.navigateTo();
12+
expect(page.getParagraphText()).toEqual('app works!');
13+
});
14+
});

e2e/app.po.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { browser, element, by } from 'protractor';
2+
3+
export class TeamDirective17Page {
4+
navigateTo() {
5+
return browser.get('/');
6+
}
7+
8+
getParagraphText() {
9+
return element(by.css('app-root h1')).getText();
10+
}
11+
}

e2e/tsconfig.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"compileOnSave": false,
3+
"compilerOptions": {
4+
"declaration": false,
5+
"emitDecoratorMetadata": true,
6+
"experimentalDecorators": true,
7+
"module": "commonjs",
8+
"moduleResolution": "node",
9+
"outDir": "../dist/out-tsc-e2e",
10+
"sourceMap": true,
11+
"target": "es5",
12+
"typeRoots": [
13+
"../node_modules/@types"
14+
]
15+
}
16+
}

karma.conf.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// Karma configuration file, see link for more information
2+
// https://karma-runner.github.io/0.13/config/configuration-file.html
3+
4+
module.exports = function (config) {
5+
config.set({
6+
basePath: '',
7+
frameworks: ['jasmine', 'angular-cli'],
8+
plugins: [
9+
require('karma-jasmine'),
10+
require('karma-chrome-launcher'),
11+
require('karma-remap-istanbul'),
12+
require('angular-cli/plugins/karma')
13+
],
14+
files: [
15+
{ pattern: './src/test.ts', watched: false }
16+
],
17+
preprocessors: {
18+
'./src/test.ts': ['angular-cli']
19+
},
20+
mime: {
21+
'text/x-typescript': ['ts','tsx']
22+
},
23+
remapIstanbulReporter: {
24+
reports: {
25+
html: 'coverage',
26+
lcovonly: './coverage/coverage.lcov'
27+
}
28+
},
29+
angularCli: {
30+
config: './angular-cli.json',
31+
environment: 'dev'
32+
},
33+
reporters: config.angularCli && config.angularCli.codeCoverage
34+
? ['progress', 'karma-remap-istanbul']
35+
: ['progress'],
36+
port: 9876,
37+
colors: true,
38+
logLevel: config.LOG_INFO,
39+
autoWatch: true,
40+
browsers: ['Chrome'],
41+
singleRun: false
42+
});
43+
};

package.json

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,28 @@
1212
},
1313
"private": true,
1414
"dependencies": {
15-
"@angular/common": "2.2.3",
16-
"@angular/compiler": "2.2.3",
17-
"@angular/core": "2.2.3",
18-
"@angular/forms": "2.2.3",
19-
"@angular/http": "2.2.3",
20-
"@angular/platform-browser": "2.2.3",
21-
"@angular/platform-browser-dynamic": "2.2.3",
22-
"@angular/router": "3.2.3",
23-
"body-parser": "^1.15.2",
15+
"@angular/common": "^2.3.1",
16+
"@angular/compiler": "^2.3.1",
17+
"@angular/core": "^2.3.1",
18+
"@angular/forms": "^2.3.1",
19+
"@angular/http": "^2.3.1",
20+
"@angular/platform-browser": "^2.3.1",
21+
"@angular/platform-browser-dynamic": "^2.3.1",
22+
"@angular/router": "^3.3.1",
2423
"core-js": "^2.4.1",
25-
2624
"express": "^4.14.0",
2725
"express-session": "^1.14.2",
2826
"mongoose": "^4.7.4",
2927
"passport": "^0.3.2",
30-
"rxjs": "5.0.0-beta.12",
28+
"rxjs": "^5.0.1",
3129
"ts-helpers": "^1.1.1",
32-
"zone.js": "^0.6.23"
30+
"zone.js": "^0.7.2"
3331
},
3432
"devDependencies": {
35-
"@angular/compiler-cli": "2.2.3",
33+
"@angular/compiler-cli": "^2.3.1",
3634
"@types/jasmine": "2.5.38",
3735
"@types/node": "^6.0.42",
38-
"angular-cli": "1.0.0-beta.22-1",
36+
"angular-cli": "1.0.0-beta.24",
3937
"codelyzer": "~2.0.0-beta.1",
4038
"jasmine-core": "2.5.2",
4139
"jasmine-spec-reporter": "2.5.0",
@@ -44,7 +42,7 @@
4442
"karma-cli": "^1.0.1",
4543
"karma-jasmine": "^1.0.2",
4644
"karma-remap-istanbul": "^0.2.1",
47-
"protractor": "4.0.9",
45+
"protractor": "~4.0.13",
4846
"ts-node": "1.2.1",
4947
"tslint": "^4.0.2",
5048
"typescript": "~2.0.3",

protractor.conf.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Protractor configuration file, see link for more information
2+
// https://github.com/angular/protractor/blob/master/lib/config.ts
3+
4+
/*global jasmine */
5+
var SpecReporter = require('jasmine-spec-reporter');
6+
7+
exports.config = {
8+
allScriptsTimeout: 11000,
9+
specs: [
10+
'./e2e/**/*.e2e-spec.ts'
11+
],
12+
capabilities: {
13+
'browserName': 'chrome'
14+
},
15+
directConnect: true,
16+
baseUrl: 'http://localhost:4200/',
17+
framework: 'jasmine',
18+
jasmineNodeOpts: {
19+
showColors: true,
20+
defaultTimeoutInterval: 30000,
21+
print: function() {}
22+
},
23+
useAllAngular2AppRoots: true,
24+
beforeLaunch: function() {
25+
require('ts-node').register({
26+
project: 'e2e'
27+
});
28+
},
29+
onPrepare: function() {
30+
jasmine.getEnv().addReporter(new SpecReporter());
31+
}
32+
};

src/app/app.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
<app-nav></app-nav>
33
<router-outlet>
44
</router-outlet>
5-
</body>
5+
</body>

src/app/app.component.spec.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/* tslint:disable:no-unused-variable */
2+
3+
import { TestBed, async } from '@angular/core/testing';
4+
import { AppComponent } from './app.component';
5+
6+
describe('AppComponent', () => {
7+
beforeEach(() => {
8+
TestBed.configureTestingModule({
9+
declarations: [
10+
AppComponent
11+
],
12+
});
13+
TestBed.compileComponents();
14+
});
15+
16+
it('should create the app', async(() => {
17+
let fixture = TestBed.createComponent(AppComponent);
18+
let app = fixture.debugElement.componentInstance;
19+
expect(app).toBeTruthy();
20+
}));
21+
22+
it(`should have as title 'app works!'`, async(() => {
23+
let fixture = TestBed.createComponent(AppComponent);
24+
let app = fixture.debugElement.componentInstance;
25+
expect(app.title).toEqual('app works!');
26+
}));
27+
28+
it('should render title in a h1 tag', async(() => {
29+
let fixture = TestBed.createComponent(AppComponent);
30+
fixture.detectChanges();
31+
let compiled = fixture.debugElement.nativeElement;
32+
expect(compiled.querySelector('h1').textContent).toContain('app works!');
33+
}));
34+
});

src/app/app.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Component } from '@angular/core';
33
@Component({
44
selector: 'app-root',
55
templateUrl: './app.component.html',
6-
styleUrls: ['./app.component.css',]
6+
styleUrls: ['./app.component.css']
77
})
88
export class AppComponent {
99
title = 'app works!';

src/app/app.module.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
import { RouterModule } from '@angular/router';
32
import { HttpModule } from '@angular/http';
43
import { NgModule } from '@angular/core';
@@ -10,7 +9,7 @@ import { AppComponent } from './app.component';
109

1110
// Pages
1211
import {HomeComponent} from './components/home.component/home.component';
13-
import {LoginComponent} from './components/login.component/login.component';
12+
import {LoginComponent} from './components/login.component/login.component';
1413
import {NavComponent} from './components/app-nav.component/app-nav.component';
1514
import { RegisterComponent } from './components/register.component/register.component'
1615

@@ -42,4 +41,4 @@ import {AuthGuard} from './guards/auth.guard';
4241
GlobalEventsManager
4342
]
4443
})
45-
export class AppModule { }
44+
export class AppModule { }

src/app/components/home.component/home.component.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,7 @@ export class HomeComponent implements OnInit {
1111

1212
constructor() { }
1313

14+
ngOnInit() {
1415

16+
}
1517
}

src/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
<body>
1212
<app-root>Loading...</app-root>
1313
</body>
14-
</html>
14+
</html>

src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ if (environment.production) {
99
enableProdMode();
1010
}
1111

12-
platformBrowserDynamic().bootstrapModule(AppModule);
12+
platformBrowserDynamic().bootstrapModule(AppModule);

src/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ getTestBed().initTestEnvironment(
2525
platformBrowserDynamicTesting()
2626
);
2727
// Then we find all the tests.
28-
let context = require.context('./', true, /\.spec\.ts/);
28+
let context = require.context('./', true, /\.spec\.ts$/);
2929
// And load the modules.
3030
context.keys().map(context);
3131
// Finally, start Karma to run the tests.

0 commit comments

Comments
 (0)