Angular Components In Depth 9 - Calling pipe inside Angular components

preview_player
Показать описание

Learn how to call pipe functions right from your Angular component TypeScript class. See how you can use pipe classes as providers and dependency inject them into your component constructor.

This course is a deep dive into components in Angular. Learn about the various features of Angular components and powerful ways of customizing your component's behaviors - Event handling, view children, change detection, content projection and more!
Рекомендации по теме
Комментарии
Автор

Great vdo. Every one is doing basic. U r doing different. Thanks

ashifali
Автор

To fix truncate use something like:
const limit = args.length > 0 ?
parseInt(args[0], 10) : args ?
parseInt(args, 10) : 20;
This logic says:
if args has a length (is an array):
limit = args[0];
else if args is not null (an integer):
limit = args;
else limit = 20;

JonathanFetzerMagic
Автор

this.blogPost.summary = this.truncatePipe.transform(this.blogPost.summary, 30);
we have pass args compulsory if u use video truncate logic

arunbandari
Автор

Question: It looks like your truncate length parameter didn't work. If you look at the output on the blog tile for the one with 'lorem ipsum', it's been truncated to 20 characters instead of 30. I believe this is because the stack overflow solution you used had a default of 20, so your 30 you passed in was not honored. Why is that?

digipukamon