Skip to content

create Pipes document#50

Open
pharanyu-nui wants to merge 1 commit intoC0D1UM:mainfrom
pharanyu-nui:angular-pipes
Open

create Pipes document#50
pharanyu-nui wants to merge 1 commit intoC0D1UM:mainfrom
pharanyu-nui:angular-pipes

Conversation

@pharanyu-nui
Copy link
Copy Markdown

No description provided.

@pharanyu-nui pharanyu-nui marked this pull request as draft July 19, 2021 12:29
@pharanyu-nui pharanyu-nui marked this pull request as ready for review July 19, 2021 12:31
@NorakGithub NorakGithub requested a review from a team July 21, 2021 04:17
Copy link
Copy Markdown
Contributor

@NorakGithub NorakGithub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job krub!

Copy link
Copy Markdown
Contributor

@piyapan039285 piyapan039285 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very good krub :) I suggest to add more topics in comment.

Comment thread angular/pipes/README.md
Comment on lines +131 to +157
### With AsyncPipe
We don't need to worry about memory leaks problem because it unsubscribes automatically.
```typescript{% raw %}
@Component({
selector: 'app-foo',
template: `
<ng-container *ngIf="people$ | async as people">
<div *ngFor="let person of people">
<p>{{ person.firstName }} {{ person.lastName }}</p>
</div>
</ng-container>
`
})
export class FooComponent implements OnInit {
people$: Observable<People[]>;

constructor(private peopleService: PeopleService) { }

ngOnInit() {
this.people$ = this.peopleService.getPeople().pipe(
tap(people => {
// do something after subscribe
})
);
}
}{% endraw %}
``` No newline at end of file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should add sub topic about "Do not use function with async pipe" because it can create infinite loop.

Many people have this problem. For example

Copy link
Copy Markdown
Member

@earthpyy earthpyy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool krub. But there are some changes might need to resolve krubb.

Comment thread angular/pipes/README.md
When you want to display the data in another format, but still want to keep the raw format data.

### Don't do this
```typescript{% raw %}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if it should includes {% raw %} and {% endraw %} krub?

Comment thread angular/pipes/README.md
}
}{% endraw %}
```
If you do like above, the function `myFormatData` will be executed every time Angular detects a change (every keystroke or mouse movement), so **it affect to the performance** if that function has a lot process inside.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
If you do like above, the function `myFormatData` will be executed every time Angular detects a change (every keystroke or mouse movement), so **it affect to the performance** if that function has a lot process inside.
If you do like above, the function `myFormatData` will be executed every time Angular detects a change (every keystroke or mouse movement), so **it affect the performance** if that function has a lot of processes inside.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants