npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

angular-rating-icons

v1.0.3

Published

Fully customizable AngularJS rating system with decimals and fontawesome

Downloads

13

Readme

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:

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.

| Attribute | Description | Type | Default | |---|---|---|---| | ng-model | (Required) Object bound to control. | String, Number, Array | - | | max | Maximum value. | Integer | 5 | | default-value | Default value if model is undefined. | Integer | 0 | | on-change | Function executed every value change. | Function | - | | decimal | Whether or not icons should fill in halves. | Boolean | false | | read-only | Whether or not is readonly. | Boolean | false | | icon-size | Size of the icons. | Integer | 20 | | icon-spacing | Spacing in pixels between the icons. | Integer | 5 | | icon-base | Base class for all icons. | String | 'fa' | | icon-empty | Icon class for empty icons. | String | 'fa-star-o' | | icon-full | Icon class for selected icons. This attribute has priority over the empty class. | String | 'fa-star' | | icon-hover | Icon class for hovered icons. This attribute has the highest class priority. | String | 'fa-star' | | color-base | Base color for icons. | String | 'black' | | color-selected | Color for selected icons. This attribute has priority over the base color. | String | 'orange' | | color-hover | Color 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.