This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@import '~ng2-slim-loading-bar/bundles/style.css'; | |
/* ... everything else ... */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... other module imports | |
import { SlimLoadingBarModule } from 'ng2-slim-loading-bar'; | |
@NgModule({ | |
// ... declarations | |
imports: [ | |
// ... other imports | |
SlimLoadingBarModule.forRoot() | |
], | |
// ... providers and bootstrap |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<md-card> | |
<!-- ... card title and subtitle --> | |
<app-task-form (taskAdded)="taskAddedHandler($event)"></app-task-form> | |
<!-- ... md-list --> | |
</md-card> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="task-form"> | |
<md-input-container> | |
<input mdInput [(ngModel)]="task" placeholder="New task"> | |
</md-input-container> | |
<button md-button md-raised-button color="primary" (click)="addTask()">Add</button> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, EventEmitter, Output } from '@angular/core'; | |
@Component({ | |
selector: 'app-task-form', | |
templateUrl: './task-form.component.html', | |
styleUrls: ['./task-form.component.css'] | |
}) | |
export class TaskFormComponent { | |
@Output() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<app-nav-bar></app-nav-bar> | |
<div class="app-container"> | |
<!-- ... card with welcome message --> | |
<app-task-list *ngIf="authService.authenticated()"></app-task-list> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.task-item { | |
padding: 10px; | |
margin-bottom: 10px; | |
background-color: #eee; | |
} | |
button.delete { | |
float: right; | |
top: -60px; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<md-card> | |
<md-card-title>Task List</md-card-title> | |
<md-card-subtitle>All your tasks in one place.</md-card-subtitle> | |
<md-list> | |
<div class="task-item" *ngFor="let task of tasks; trackBy: $index"> | |
<p><small><strong>{{ task.createdAt | date: 'short' }}</strong></small></p> | |
<p>{{ task.description }}</p> | |
<button class="delete" md-button md-raised-button | |
color="accent" (click)="deleteTask(task)">Delete</button> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, OnInit } from '@angular/core'; | |
import { TaskListService } from './task-list.service'; | |
@Component({ | |
selector: 'app-task-list', | |
templateUrl: './task-list.component.html', | |
styleUrls: [ './task-list.component.css' ] | |
}) | |
export class TaskListComponent implements OnInit { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... other imports | |
import { Http, RequestOptions } from '@angular/http'; | |
import { AuthHttp, AuthConfig } from 'angular2-jwt'; | |
import { TaskListService } from './task-list/task-list.service'; | |
// creates a factory to AuthHttp | |
export function authHttpFactory(http: Http, options: RequestOptions) { | |
return new AuthHttp(new AuthConfig(), http, options); | |
} |