Socket
Socket
Sign inDemoInstall

angular-rating-icons

Package Overview
Dependencies
2
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    angular-rating-icons

Fully customizable AngularJS rating system with decimals and fontawesome


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Angular-rating-icons

The first fully customizable AngularJS rating system that is as easy as it gets.

Its best feature? It works with any icon from font-awesome, even if you want to fill only half of it!

Check the live demo here if you didn't understand!

Table of contents

Getting started

There are several ways to install:

  • Download the latest release.
  • Install with Bower: bower install angular-rating-icons.
  • Install with npm: npm install angular-rating-icons.

Include the files in your index page:

// CSS
<link type="text/css" rel="stylesheet" href="..(your source)../angular-rating-icons/dist/angular-rating-icons.min.css">

// JavaScript
<script src="..(your source)../angular-rating-icons/dist/angular-rating-icons.min.js"></script>

Add the module to your main module's list of dependencies:

angular.module('yourApp', [
	// ...
	'angular-rating-icons',
	// ...
]);

How to use

To get it running, just add one of the the blocks of HTML code bellow to your view. Don't forget that your model should be an object, as per the ng-model golden dot rule, to deal with scope inheritance.

<angular-rating-icons ng-model="YourObject.ratingValue"></angular-rating-icons>

<div angular-rating-icons ng-model="YourObject.ratingValue"></div>

<!-- Best practice: This is the most valid HTML code should you use any validation tool. -->
<div data-angular-rating-icons ng-model="YourObject.ratingValue"></div>

Attributes

There are a number of possible customizations to this directive. Bellow is a table with all the latest version attributes and their information.

AttributeDescriptionTypeDefault
ng-model(Required) Object bound to control.String, Number, Array-
maxMaximum value.Integer5
default-valueDefault value if model is undefined.Integer0
on-changeFunction executed every value change.Function-
decimalWhether or not icons should fill in halves.Booleanfalse
read-onlyWhether or not is readonly.Booleanfalse
icon-sizeSize of the icons.Integer20
icon-spacingSpacing in pixels between the icons.Integer5
icon-baseBase class for all icons.String'fa'
icon-emptyIcon class for empty icons.String'fa-star-o'
icon-fullIcon class for selected icons. This attribute has priority over the empty class.String'fa-star'
icon-hoverIcon class for hovered icons. This attribute has the highest class priority.String'fa-star'
color-baseBase color for icons.String'black'
color-selectedColor for selected icons. This attribute has priority over the base color.String'orange'
color-hoverColor for hovered icons. This attribute has the highest color priority .String'orange'

Customization

You can fully customize the directive by downloading and changing the CSS file in /src/angular-rating-icons.css. Be mindful that decimal type uses specific code to reduce the icons to half and position them properly next to their correspondent half.

Customizing the CSS is at the risk of visual malfunction of this directive.

Dependencies

This package uses FontAwesome as fallback if no class is given to the icons.

Bugs and feature requests

If you found a bug or have a feature request, please open a new issue.

Requested features list:

  • Add Angular's pristine to an attribute.
  • Add form validation to an attribute.
  • Add attribute for a new custom class to be added.
  • Add MaterializeCSS support.
  • Add reset functionality.
  • Only execute set value when it's different than the original.

Contributing

Feel free to contribute in any way you like. All pull requests will be reviewed and your code will be changed to match this project's guidelines should it not follow them, and issues will be answered and resolved as soon as possible.

Versioning

Angular-rating-icons is maintained under the Semantic Versioning guidelines.

See the Releases section of this GitHub project for changelogs for each release.

Credits and author

This project's early development was based on melloc01's repository, angular-input-stars. I needed more features from his package and to work in a different way, specifically the feature to add half (decimal) ratings like 2,5.

So I thought I'd build my own and increase it's feature list like allowing it to be fully customizable, using callbacks on value (rating) change and so on. It has since evolved past melloc01's project, but I can't help thanking and crediting him for being my early prototype.

License

Code and documentation copyright 2016 filipetedim © Filipe Tedim. Code released under the MIT license.

Keywords

FAQs

Last updated on 20 Sep 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc