Skip to content

Commit

Permalink
fix folders
Browse files Browse the repository at this point in the history
  • Loading branch information
sarareisner committed Jun 20, 2017
1 parent 0a5b2df commit 4bf1d89
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 19 deletions.
4 changes: 0 additions & 4 deletions src/app/posts/new-post/new-post.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@ import { DocumentNode } from 'graphql';
import { Apollo, ApolloQueryObservable } from 'apollo-angular';
import { ApolloQueryResult } from 'apollo-client';

import { Post } from '../shared/post';
import { GetPostsQuery, AddPostMutation, PostsInterface } from './new-post.graphql.ts';

//import { BasicValidators } from '../../shared/basic-validators';

@Component({
selector: 'new-post',
// moduleId:module.id,
Expand All @@ -25,7 +22,6 @@ export class NewPostComponent implements OnInit {
form: FormGroup;
title: string;
content:string;
post: Post = new Post();

constructor(
formBuilder: FormBuilder,
Expand Down
4 changes: 4 additions & 0 deletions src/app/posts/posts-filter/post.interface.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export interface IPost {
postId: number;
title: string;
}
12 changes: 12 additions & 0 deletions src/app/posts/posts-filter/posts-filter.pipe.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import {PipeTransform,Pipe} from '@angular/core';
import {IPost} from './post.interface'
@Pipe({
name:'postsFilter'
})
export class PostsFilterPipe implements PipeTransform{
transform(value :IPost[], filtetBy:string):IPost[]{
filtetBy= filtetBy? filtetBy.toLocaleLowerCase():null;//search in each product if is the same
return filtetBy ? value.filter((post:IPost)=>post.title.toLocaleLowerCase().indexOf(filtetBy) !==-1) : value;
}

}
2 changes: 1 addition & 1 deletion src/app/posts/posts.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { routes } from './posts.routes';
import { PostsComponent } from './posts.component';
import { postDetailComponent } from './post-detail/post-detail.component';
import { NewPostComponent } from './new-post/new-post.component';
import {PostsFilterPipe} from './posts-filter.pipe'
import {PostsFilterPipe} from './posts-filter/posts-filter.pipe'

@NgModule({
declarations: [
Expand Down
11 changes: 0 additions & 11 deletions src/app/posts/posts.ts

This file was deleted.

3 changes: 0 additions & 3 deletions src/app/posts/shared/post.ts

This file was deleted.

0 comments on commit 4bf1d89

Please sign in to comment.