ng-Rating
A simple directive using the jQuery Raty plugin.
Source: https://github.com/wbotelhos/raty
HTML
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.5/angular.min.js"></script>
<link rel="stylesheet" href="//cdn.jsdelivr.net/foundation/5.0.2/css/foundation.min.css">
<div id='1'>
</div
<div id='1-pontFinal'>
</div>
CSS
.panel {
margin: 10px;
}
JavaScript
$(function () {
$('#1').raty(
{cancel: true,size: 24,cancelOff: 'eraser-off.png',cancelOn: 'eraser.png',starOff : 'star-off-big.png',starOn: 'star-on-big.png',cancelPlace: 'right',click:
function (score, evt) {var target = $('#1-pontFinal');var peso = 2;if (score === null) {target.html('0.0');} else if (score === undefined) {target.empty();} else {target.html(((score*peso)/5));};}});});
/*!
* jQuery Raty - A Star Rating Plugin
*
* Licensed under The MIT License
*
* @version 2.5.2
* @author Washington Botelho
* @documentation wbotelhos.com/raty
*
*/
;(function(b){var a={init:function(c){return this.each(function(){a.destroy.call(this);this.opt=b.extend(true,{},b.fn.raty.defaults,c);var e=b(this),g=["number","readOnly","score","scoreName"];a._callback.call(this,g);if(this.opt.precision){a._adjustPrecision.call(this);}this.opt.number=a._between(this.opt.number,0,this.opt.numberMax);this.opt.path=this.opt.path||"";if(this.opt.path&&this.opt.path.slice(this.opt.path.length-1,this.opt.path.length)!=="/"){this.opt.path+="/";}this.stars=a._createStars.call(this);this.score=a._createScore.call(this);a._apply.call(this,this.opt.score);var f=this.opt.space?4:0,d=this.opt.width||(this.opt.number*this.opt.size+this.opt.number*f);if(this.opt.cancel){this.cancel=a._createCancel.call(this);d+=(this.opt.size+f);}if(this.opt.readOnly){a._lock.call(this);}else{e.css("cursor","pointer");a._binds.call(this);}if(this.opt.width!==false){e.css("width",d);}a._target.call(this,this.opt.score);e.data({settings:this.opt,raty:true});});},_adjustPrecision:function(){this.opt.targetType="score";this.opt.half=true;},_apply:function(c){if(c&&c>0){c=a._between(c,0,this.opt.number);this.score.val(c);}a._fill.call(this,c);if(c){a._roundStars.call(this,c);}},_between:function(e,d,c){return...