Interactive Rating Card Component Using Angular and SCSS
Design comparison
Solution retrospective
Hi Everyone,
Here is my solution for Interactive Rating Card Component done in Angular, HTML5 and SCSS. Feel free to go through my code and give suggestions for improving my code. Alternate solutions are also welcome.
Note: HTML5 issues might come up due to ng-content added by Angular.
Thanks in advance.
Community feedback
- @christopher-adolphePosted over 2 years ago
Hi @athirasarman,
You did a nice job in completing this challenge with Angular. Below are a few things I have noticed and you might want to check in order to improve your solution.
- When I look at the design of the rating component, I see a form with radio buttons for the different rating values and a submit button. However, the markup of your
HowDidWeDoComponent
component is using<div>
elements etc. While this is actually working, I would strongly recommend you to build your components with elements that are meant for the purpose. Something like this:
<form class="form"> <div class="form__group"> <label class="form__label for="rating-1"> <input id="rating-1" type="radio" class="form__input" value="1" name="rating" /> </label> <label class="form__label for="rating-2"> <input id="rating-2" type="radio" class="form__input" value="2" name="rating" /> </label> </div> <button type="submit" class="form__btn">Submit</button> </form>
This would be much better in terms of semantics and would be a good opportunity for you to try either a template-driven or reactive form approach with Angular.
- At the moment if a user enters a route that doesn't exist, he gets a blank page. It is a good practice to set up a route to handle such situation. You could do so by setting up wildcard route like this:
app-routing.module.ts (excerpt):
const routes: Routes = [ { path: '', component: HowDidWeDoComponent }, { path: 'thankyou', component: ThankYouComponent }, { path: '**', component: HowDidWeDoComponent } ];
I hope this helps.
Keep it up.
Marked as helpful1@christopher-adolphePosted over 2 years agoHi @athirasarman,
I'm happy to help.
Best regards.
0 - When I look at the design of the rating component, I see a form with radio buttons for the different rating values and a submit button. However, the markup of your
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord