Skip to content

Commit

Permalink
(feat): comments now post through
Browse files Browse the repository at this point in the history
  • Loading branch information
markharding committed Jan 20, 2017
1 parent d39aad8 commit 69b392f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/app/modules/comments/list.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<div class="m-ionic-body">
<m-textarea placeholder="Write your comment..." [(mModel)]="message"></m-textarea>
</div>
<div class="m-ionic-comments--actions">
<div class="m-ionic-comments--actions" *ngIf="message">
<ion-icon name="md-send" (click)="post()"></ion-icon>
</div>
</div>
2 changes: 2 additions & 0 deletions src/app/modules/comments/list.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
}

.m-ionic-comments--actions{
display: flex;
align-items: center;
ion-icon{
font-size:24px;
}
Expand Down
11 changes: 10 additions & 1 deletion src/app/modules/comments/list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,16 @@ export class CommentsList {
}

post(){

this.client.post('api/v1/comments/' + this.params.get('guid'), {
comment: this.message
})
.then((response : any) => {
this.message = "";
this.comments.push(response.comment);
this.cd.markForCheck();
this.cd.detectChanges();
this.scrollArea.scrollToBottom(300);
});
}


Expand Down

0 comments on commit 69b392f

Please sign in to comment.