Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

app to be developed further #5

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
todays
Sowmya Thallapragada authored and Sowmya Thallapragada committed Sep 11, 2017
commit c622afe7ac42ee22c57d1a90049d52e970f9f0d2
2 changes: 1 addition & 1 deletion TODO-App-Tobeworked/src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<app-navigation-bar></app-navigation-bar>
<div class="container">
<app-home-component></app-home-component>
<router-outlet></router-outlet>
</div>
14 changes: 12 additions & 2 deletions TODO-App-Tobeworked/src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -6,17 +6,27 @@ import { HomeComponentComponent } from './home-component/home-component.componen
import { NavigationBarComponent } from './navigation-bar/navigation-bar.component';
import { TodoListComponent } from './todo-list/todo-list.component';
import { HttpModule } from '@angular/http';
import { RouterModule } from '@angular/router';
import { ArchiveComponent } from './archive/archive.component';

@NgModule({
declarations: [
AppComponent,
HomeComponentComponent,
NavigationBarComponent,
TodoListComponent
TodoListComponent,
ArchiveComponent
],
imports: [
BrowserModule,
HttpModule
HttpModule,
RouterModule.forRoot([
{ path: 'home',component: HomeComponentComponent},

{ path: 'archive',component: ArchiveComponent},
{ path: '',redirectTo:'home',pathMatch: 'full' }

])
],
providers: [TodoDataService],
bootstrap: [AppComponent]
Empty file.
3 changes: 3 additions & 0 deletions TODO-App-Tobeworked/src/app/archive/archive.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<p>
archive works!
</p>
25 changes: 25 additions & 0 deletions TODO-App-Tobeworked/src/app/archive/archive.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { ArchiveComponent } from './archive.component';

describe('ArchiveComponent', () => {
let component: ArchiveComponent;
let fixture: ComponentFixture<ArchiveComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ArchiveComponent ]
})
.compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(ArchiveComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should be created', () => {
expect(component).toBeTruthy();
});
});
15 changes: 15 additions & 0 deletions TODO-App-Tobeworked/src/app/archive/archive.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';

@Component({
selector: 'app-archive',
templateUrl: './archive.component.html',
styleUrls: ['./archive.component.css']
})
export class ArchiveComponent implements OnInit {

constructor() { }

ngOnInit() {
}

}
Original file line number Diff line number Diff line change
@@ -11,10 +11,10 @@ export class HomeComponentComponent implements OnInit {
constructor(private TodoDataService: TodoDataService) { }

ngOnInit() {
debugger;

var abc = this.TodoDataService.getTodoList();
console.log(abc);
debugger;

}

}
4 changes: 3 additions & 1 deletion TODO-App-Tobeworked/src/app/models/todo.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
export class todo{
id : string;
name : string;
type : string;
isDone: boolean;
constructor(name: string,type:string,isDone:boolean){
constructor(id: string,name: string,type:string,isDone:boolean){
this.id = id;
this.name = name;
this.type = type;
this.isDone = isDone;
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<nav style="background-color:lightgreen">
<div class="nav-wrapper">
<a href="#" class="brand-logo">Todo-App</a>
<a routerLink="home" class="brand-logo">Todo-App</a>
<ul id="nav-mobile" class="right hide-on-med-and-down">
<li><a href="sass.html">Archive</a></li>
<li><a routerLink="archive">Archive</a></li>
<li><a href="badges.html">About</a></li>
</ul>
</div>
34 changes: 19 additions & 15 deletions TODO-App-Tobeworked/src/app/services/todo-data.service.ts
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ import { Http} from '@angular/http';
import * as _ from 'lodash';
@Injectable()
export class TodoDataService {
firebaseUrl : string = "https://myapp-afa97.firebaseio.com/todo.json";
firebaseUrl : string = "https://tododemo-6ab8f.firebaseio.com/working.json";
private toDoValues: todo[];
constructor(private _http: Http) {
this.toDoValues = [];
@@ -18,21 +18,25 @@ export class TodoDataService {
}
getTodoList(){
//return this.toDoValues;
debugger;
this._http.get(this.firebaseUrl)

this._http.get(this.firebaseUrl)
.subscribe(myresp =>{

const resObj = myresp.json();
this.toDoValues = _.values(resObj).map((data:todo)=>{
console.log('TODO',this.toDoValues);
return new todo(data.name,data.type,data.isDone);
const resObj = myresp.json();
// this.toDoValues = _.values(resObj).map((data:todo)=>{
// console.log('TODO',this.toDoValues);
// return new todo(data.id,data.name,data.type,data.isDone);

})


});
// })


console.log(resObj);
console.log(Object.keys(resObj));
for(let i=0;i<Object.keys(resObj).length;i++){
let obj1 = resObj[Object.keys(resObj)[i]];
console.log(obj1);
let newTodo = new todo(Object.keys(resObj)[i],obj1.name,obj1.type,obj1.isDone)
this.toDoValues.push(newTodo);
}
});

}
getProjectTodos(){
@@ -43,8 +47,8 @@ export class TodoDataService {
return this.toDoValues.filter(todo => todo.type === 'Personal');

}
addTodo(name:string,type:string, isDone: boolean ){
let newTodo = new todo(name,type, isDone);
addTodo(id:string,name:string,type:string, isDone: boolean ){
let newTodo = new todo(id,name,type, isDone);
//this.toDoValues.push(newTodo);
//console.log(this.toDoValues);
// this._http.post(this.firebaseUrl,newTodo).subscribe((function(data){
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<h3>{{title}}</h3>
<div class="input-field">
<input placeholder="What Do you want to do" type="text" #itemText (keyup.enter)="onEnterPress(itemText.value)" >
<input placeholder="What Do you want to do" type="text" #itemText (keyup.enter)="onEnterPress(itemText.value);itemText.value='';" >

</div>
<p *ngFor = "let item of itemList">
<input type="checkbox" id="test5" />
<label for="test5">{{item.name}}</label>
<p *ngFor = "let item of itemList; let i = index" >
<input #check type="checkbox" [id]=i />{{i}}{{check.id}}
<label for={{i}}>{{item.name}}</label>
</p>