.fa-star{
color: #FD4;
transition: all .25s;
}
,.fa-star-o{
color: #eeeeee;
transition: all .25s;
}
.fa-star:hover,.fa-star-o:hover {
transform: rotate(-15deg) scale(1.3);
}
JavaScript
var app = angular.module('myApp', []);
app.factory("myfactory", function($http, $timeout, $filter, $rootScope) {
return {
basketTotal: function() {
var ttl = 20; // so lets set it to our pre-determined sum
// loop basket and get full value of basket set as value
// THEN SHIPPING - using rootScope allows us to capture the data throughout the site $root
$rootScope.basketshippingfee = (ttl <= 20) ? 6 : $rootScope.ship;
ttl = (ttl + $rootScope.basketshippingfee);
return ttl
},
basketTax: function( ) {
var bt = $rootScope.tax;
return bt
},
basketShipping: function( ) {
var bs = $rootScope.basketshippingfee ? $rootScope.basketshippingfee : $rootScope.ship;
return bs
}
}
/*
function funct1() {
alert("ONE")
return funct1()
.then( function( data ) {
funct2()
});
}
function funct2() {
alert("TWO")
}
return {
funct1: funct1,
funct2: funct2
};*/
});
app.directive('generateStars', function() {
var html = '<div style="display:inline-block"><i class="fa fa-star" ng-repeat="n in []| range:roundedAmount" ng-if="($index <= 5)"></i><i ng-repeat="n in [] | range:5-roundedAmount" ng-if="($index < 5) " class="fa fa-star-o text-muted"></i></div>';
return {
restrict: 'E',
scope: {
amount: '='
},
link: function(scope, element, attrs) {
scope.roundedAmount = parseInt(scope.amount);
},
replace: true,
template: html
};
})
app.filter('range', function() {
return function(input, total) {
total = parseInt(total);
for (var i = 0; i < total; i++)
input.push(i);
return input;
};
});
app.controller('NavController', function(myfactory, $rootScope) {
// THESE VALUES ARE PULLED FROM OUR GLOBAL VARS and DB of BASKET ITEMS
$rootScope.ship = 0;
$rootScope.tax = 0; // 0 rated for online only
$rootScope.itemprice = 20; // We will reference LS for this.
// We can set...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.