Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Interactive Rating Card Component Using Angular and SCSS

Athira 130

@athirasarman

Desktop design screenshot for the Interactive rating component coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
1newbie
View challenge

Design comparison


SolutionDesign

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

P

@christopher-adolphe

Posted

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 helpful

1

Athira 130

@athirasarman

Posted

@christopher-adolphe Sure. Thanks!

0
P

@christopher-adolphe

Posted

Hi @athirasarman,

I'm happy to help.

Best regards.

0

Please log in to post a comment

Log in with GitHub
Discord logo

Join 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