Skip to content

Commit 819d55c

Browse files
committed
Added Log In & Log Out buttons and <router-outlet> to APP Component
Added Log In & Log Out buttons and <router-outlet> to APP Component and Imported Auth Serivice
1 parent 5af4dae commit 819d55c

File tree

3 files changed

+8
-23
lines changed

3 files changed

+8
-23
lines changed

src/app/app.component.html

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1-
<h1>
2-
{{title}}
3-
</h1>
1+
<div class="navbar-header">
2+
<a class="navbar-brand" href="#">Auth0 - Angular 2</a>
3+
<button class="btn btn-primary btn-margin" (click)="auth.login()" *ngIf="!auth.authenticated()">Log In</button>
4+
<button class="btn btn-primary btn-margin" (click)="auth.logout()" *ngIf="auth.authenticated()">Log Out</button>
5+
</div>
6+
<router-outlet></router-outlet>

src/app/app.component.spec.ts

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,4 @@ describe('AppComponent', () => {
1111
],
1212
});
1313
});
14-
15-
it('should create the app', async(() => {
16-
let fixture = TestBed.createComponent(AppComponent);
17-
let app = fixture.debugElement.componentInstance;
18-
expect(app).toBeTruthy();
19-
}));
20-
21-
it(`should have as title 'app works!'`, async(() => {
22-
let fixture = TestBed.createComponent(AppComponent);
23-
let app = fixture.debugElement.componentInstance;
24-
expect(app.title).toEqual('app works!');
25-
}));
26-
27-
it('should render title in a h1 tag', async(() => {
28-
let fixture = TestBed.createComponent(AppComponent);
29-
fixture.detectChanges();
30-
let compiled = fixture.debugElement.nativeElement;
31-
expect(compiled.querySelector('h1').textContent).toContain('app works!');
32-
}));
3314
});

src/app/app.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { Component } from '@angular/core';
2+
import { Auth } from './auth/auth.service';
23

34
@Component({
45
selector: 'app-root',
56
templateUrl: './app.component.html',
67
styleUrls: ['./app.component.css']
78
})
89
export class AppComponent {
9-
title = 'app works!';
10+
constructor(private auth: Auth) {}
1011
}

0 commit comments

Comments
 (0)