问题
I took over an AngularJS (Cordova) project being a newbie in this area. Now I have to add a new "wheel-item" called "Eingepasst", which is different to the existing ones like i.e. "Partnerspiel" (see picture).
When having clicked the button on top-right a valued called "Spielwert" (here: 22) will be written to the 'Model' (talking about MVC).
The related part of the code is inside a "factory"-JavaScript-file" called 'game.factory.js':
angular.module('app').factory('Game', function (Settings, Round)
{
function MODEL()
{
return {
type:
[
{
key: 'EI',
value: 'Eingepasst',
rate: Settings.get('eingepasstRate'), //from there the minus-value is derived for adjusted
variants:
[
{ key: 'E0', value: 'Regulär', multiplier: 1, rate: Settings.get('eingepasstRate') }
]
},
Unfortunately I could not figure out, where 'key', 'value', 'multiplier' and 'rate' derive from...
However I want to add a function call here to run some calculations inside the code snippet above. What do I have to do here? Please be as detailed as possible...
来源:https://stackoverflow.com/questions/37008268/how-to-add-a-function-in-angularjs-factory