Categories

Sunday, November 24, 2024
#919814419350 therichposts@gmail.com
Angular 8Angular 9Angular7

Angular 7,8,9 useful 5 hacks

Angular 9, Angular 10

Hello to all, welcome to therichpost.com. In this post, I will tell you, Angular 7,8,9 useful 5 hacks.

1. Limit string length in angular:

 <p class="card-text">{{item.description | slice:0:100}}...</p>
// This will show first 100 words

2. String replace in Angular:

<p class="card-text">{{item.title.replace(' ','-')}}</p>
// This will replace empty space with -

3. String Lowercase in Angular:

<p class="card-text">{{item.description | lowercase}}</p>

4. Date Format in Angular:

<div class="date">{{item.dateadded | date:'dd'}}<br>{{item.dateadded | date:'MMM'}}</div>
// This will show the date in format what you want

5. Looping in Angular:

 <ul>
   <li *ngFor="let tag of tags; let i = index" [attr.data-index]="i">
       <a href="#">{{tag}}</a>
   </li>
 </ul>
// tags data is coming from angular component and number the tags data will generate same number of li

 

I will share more in angular and if you have any query then please let me know.

Jassa

Thank you

therichpost
the authortherichpost
Hello to all. Welcome to therichpost.com. Myself Ajay Malhotra and I am freelance full stack developer. I love coding. I know WordPress, Core php, Angularjs, Angular 19, MedusaJs, Next.js, Bootstrap 5, Nodejs, Laravel, Codeigniter, Shopify, Squarespace, jQuery, Google Map Api, Vuejs, Reactjs, Big commerce etc.

2 Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.