Angular πŸ‡ΊπŸ‡¦ - practical notes
1.63K subscribers
1.6K photos
1 file
532 links
Angular - practical notes

This group is for posting practical notes for Angular developers. Mostly all posts are for quick implementation https://t.me/angular_practical_notes (Commenting on posts only in ENG and UA langs here). Welcome!
Download Telegram
This media is not supported in your browser
VIEW IN TELEGRAM
✳️ Implementing a Loading Skeleton in Angular

#angular #directive #skeleton #ui_element

Skeletons are placeholder elements that are displayed before the actual content is loaded on a webpage. A skeleton is usually a light gray box or circle that you see on websites like Medium, YouTube, etc. Skeletons convey a visual impression of the feature, which gives them an advantage over spinners.

βœ… Article Link: https://netbasal.com/implementing-a-loading-skeleton-in-angular-7490ffdecc1b

🎁 Code Link:
Step 1: https://gist.github.com/NetanelBasal/33f8ec9a106ee2367f3b9847fd3043cb#file-rect-ske-component-ts

Step 2: https://gist.github.com/NetanelBasal/82030b63d6ed0055c09a543483bd3470#file-skeleton-directive-ts

Step 3: https://gist.github.com/NetanelBasal/0f26e85d13d10a9e564541553094c12f#file-skeleton-demo-html
Please open Telegram to view this post
VIEW IN TELEGRAM
This media is not supported in your browser
VIEW IN TELEGRAM
πŸ”„ Microinteractions: The Secret of Great App Design 1/5

#ui #design

Show System Status
The first usability heuristic principle by Jakob Nielsen states: keep your user informed about what is going on. When users trigger an operation, they expect to get immediate response. But there are situations when an app needs some time to complete an operation. So, the interface should keep the user enlightened about what is happening.

What is a Microinteraction Anyway?
Microinteractions are the contained product moments that do one small task.

As first described in Dan Saffer’s book Microinteractions, these tiny details typically serve these essential functions:

- Communicate feedback or the result of an action.
- Accomplish an individual task.
- Enhance the sense of direct manipulation.
- Help users visualize the results of their actions and prevent errors.

βœ… Article link: https://uxplanet.org/microinteractions-the-secret-to-great-app-design-4cfe70fbaccf
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘1
This media is not supported in your browser
VIEW IN TELEGRAM
πŸ”„ Microinteractions: The Secret of Great App Design 2/5

#ui #design

Highlight Changes
When any important event happens, we need to show notifications to inform users about that. Animation can help achieve this goal. It will attract users attention and won’t let users overlook what you think is important.

βœ… Article link: https://uxplanet.org/microinteractions-the-secret-to-great-app-design-4cfe70fbaccf
Please open Telegram to view this post
VIEW IN TELEGRAM
This media is not supported in your browser
VIEW IN TELEGRAM
πŸ”„ Microinteractions: The Secret of Great App Design 3/5

#ui #design

Keep Context
Use motion to smoothly transport users between navigational contexts, explain changes in the arrangement of elements on a screen. This is especially true for mobile devices and smart watches, because it’s simply impossible to fit a lot of information on one screen and any screen state change should be crystal clear for your users.

βœ… Article link: https://uxplanet.org/microinteractions-the-secret-to-great-app-design-4cfe70fbaccf
Please open Telegram to view this post
VIEW IN TELEGRAM
This media is not supported in your browser
VIEW IN TELEGRAM
πŸ”„ Microinteractions: The Secret of Great App Design 4/5

#ui #design

Visualize Input
Data input is one of the most important elements of any application. And micro-interactions turn this process into something special. You can use existing visual elements to deliver feedbackβ€”just add nice visual details.

βœ… Article link: https://uxplanet.org/microinteractions-the-secret-to-great-app-design-4cfe70fbaccf
Please open Telegram to view this post
VIEW IN TELEGRAM
This media is not supported in your browser
VIEW IN TELEGRAM
πŸ”„ Microinteractions: The Secret of Great App Design 5/5

#ui #design

Call to Action
Microinteractions have the power to encourage users to actually interact. By bringing empathy in user experience, you have a better chances users will make a move. But make sure the visual cues and animations are appropriate for your users. And keep longevity in mind β€” will the microinteraction get annoying on the 100th use, or is it universally clear and unobtrusive?

βœ… Article link: https://uxplanet.org/microinteractions-the-secret-to-great-app-design-4cfe70fbaccf
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ“„ Reusable Checkbox Input in Angular

#angular #ui_element #ControlValueAccessor

All we need to do is to use its selector inside our <form> HTML element with FormGroup:

<app-checkbox-input 
formControlName="fullName"
label="Check by Full Name"
></app-checkbox-input>


🚩 > Angular v16

βœ… Article link: https://blog.bitsrc.io/how-ive-created-reusable-checkbox-input-in-angular-16-5fd470f26104
πŸ“„ Deactivate Route Guards in Angular

#angular #guard #ui_element

The CanDeactivate route guard in Angular is responsible for determining if a route can be deactivated. It is commonly used when you want to check if the user is allowed to leave a particular component or route, perhaps due to unsaved changes or other dynamic conditions.


βœ… Article link
πŸ”₯2
πŸ“„ Simple Unsaved Data Changes Guard in Angular 17+

#angular #guard #ui_element

...when a user wants to navigate to other routes having pending data changes in the current page...


βœ… Article link
πŸ‘5
This media is not supported in your browser
VIEW IN TELEGRAM
πŸ“„ Customizable Angular animations

#angular #animations #ui_element

...A component with customizable animations might look like this...


// collapse.ts

const closedStyle = style({
height: 0
});

const openStyle = style({
height: '*'
});

const timings = '{{duration}}ms linear';

const defOptions: AnimationOptions = {
params: {
duration: 300
}
};

export const collapse = trigger('collapse', [
transition(
':enter',
animation([closedStyle, animate(animateTimings, openStyle)]),
defaultOptions
),
transition(
':leave',
animation([openStyle, animate(animateTimings, closedStyle)]),
defaultOptions
),
]);


// bonus.component.ts

@Component({
animations: [collapse],
host: {
'[@collapse]': 'animationOptions',
},
})
export class BonusComponent implements OnInit {
@Input() public duration = 300;
public options!: IAnimationOptions<string>

public ngOnInit(): void {
this.options = {
value: '_',
params: {
duration: this.duration
},
};
}
}


βœ… Article link
πŸ‘3❀1πŸ”₯1
πŸ“„Managing the Sticky Navigation: Angular, Tailwind, and RxJS

#angular #rxjs #tailwind #navbar #ui_element

Explanation:
β€” `public readonly isSticky$ = fromEvent(window, 'scroll').pipe(...):` This defines the isSticky$ observable using RxJS operators. It listens for scroll events on the window, maps them to the vertical scroll position (window.scrollY), filters out consecutive duplicate values, and then maps the scroll position to a boolean value indicating whether the scroll position is greater than 24 (assuming 24 is a threshold value for determining when the navigation bar should become sticky).

β€” `distinctUntilChanged()`: This operator filters out consecutive duplicate values emitted by the observable.

β€” `map((scrollTop: number) => scrollTop > 24)`: This operator maps the scroll position (scrollTop) to a boolean value, indicating whether the user has scrolled past a certain threshold (24 in this case).

β€” `(isSticky$ | async) === true`: This condition checks if the value emitted by the isSticky$ is true or not. Which makes it convenient since you don’t have to unsubscribe the observable.

β€” `sticky top-0 z-10 shadow-lg opacity-95 bg-white`: These classes from TailWind will help enhance the sticky experience when the users scroll down.


βœ… Article link